【问题标题】:Create entity for events in CRM 2011在 CRM 2011 中为事件创建实体
【发布时间】:2016-09-28 19:39:47
【问题描述】:

我使用 C# 构建了一个 Web api 来与 CRM 进行通信。我成功检索帐户。我想要做的是我想从 CRM 中检索事件。我想我必须为 crm 中的事件创建实体,但我该怎么做?

这是帐户的代码

ColumnSet colsPrincipal = new ColumnSet("lastname", "firstname", "domainname", "systemuserid", "businessunitid");

 QueryExpression queryPrincipal = new QueryExpression();
 queryPrincipal.EntityName = "event";//systemuser
 queryPrincipal.ColumnSet = colsPrincipal;

 var myAccounts = CommonCrm.crmContext.RetrieveMultiple(queryPrincipal);
        foreach (var myEntity in myAccounts.Entities)
        {
            //create new crm users and add it to the list
            CrmUser thisOne = new CrmUser();

            thisOne.firstName = myEntity.GetAttributeValue<string>("firstname");
            thisOne.lastName = myEntity.GetAttributeValue<string>("name");
            thisOne.userId = myEntity.GetAttributeValue<string>("domainname");
            thisOne.userGuid = myEntity.GetAttributeValue<Guid>("systemuserid");
            thisOne.buId = myEntity.GetAttributeValue<EntityReference>("businessunitid").Id;
            // and so on and so forth...         
            Console.Write(thisOne.firstName + "   " + thisOne.userGuid + "   " + thisOne.lastName);
            CrmUsers.Add(thisOne);
            arra.Add(thisOne.firstName);
        }

【问题讨论】:

    标签: c# wcf dynamics-crm-2011 dynamics-crm


    【解决方案1】:

    最简单的方法是通过 CRM 定制和解决方案。由于这是一个相当大的话题,我建议你开始使用这个link

    【讨论】:

    • 我们已经有了事件实体,这是 CRM 附带的默认实体,但我找不到像这样指向的方法:queryPrincipal.EntityName = "//systemuser";
    猜你喜欢
    • 2013-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多