2016-05-30 10 views
0

CRMと通信するためにC#を使用してWeb APIを構築しました。私は口座を取り戻すことに成功しました。私がしたいのは、CRMからイベントを取得することです。私はcrmのイベントのエンティティを作成しなければならないと思いますが、どうすればいいのですか?CRM 2011でイベントのエンティティを作成

これは、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); 
     } 

答えて

0

最も簡単な方法です。これはかなり巨大な話題なので、私はあなたがこれを始めることをお勧めしたいと思いますlink

+0

私はすでにイベントエンティティを持っていますが、デフォルトのCRMが付属していますが、このように指す方法を見つけることができません: queryPrincipal.EntityName = "// systemuser"; –

関連する問題