C# 在“来自帐户实体的活动”中从CRM检索电子邮件

C# 在“来自帐户实体的活动”中从CRM检索电子邮件,c#,dynamics-crm,crm,C#,Dynamics Crm,Crm,这是我发送电子邮件的代码 private void SendEmail(Guid accountToGuid) { string name = GetName(service, accountToGuid); #region Email Entity fromParty = new Entity("activityparty"); fromParty["partyid"] = new EntityReference("sy

这是我发送电子邮件的代码

private void SendEmail(Guid accountToGuid)
    {
        string name = GetName(service, accountToGuid);

        #region Email
        Entity fromParty = new Entity("activityparty");
        fromParty["partyid"] = new EntityReference("systemuser", ownerId);
        Entity toParty = new Entity("activityparty");
        toParty["partyid"] = new EntityReference("account", accountToGuid);

        Entity Email = new Entity("email");
        Email.Attributes["from"] = new Entity[] { fromParty };
        Email.Attributes["to"] = new Entity[] { toParty };
        Email.Attributes["subject"] = "Hello " + name;
        Email.Attributes["description"] = "Your account has been confirmed by Admin";
        Email.Attributes["ownerid"] = new EntityReference("systemuser", ownerId);
        Guid EmailId = service.Create(Email);

        SendEmailRequest req = new SendEmailRequest();

        req.EmailId = EmailId;
        req.IssueSend = true;
        req.TrackingToken = "";

        SendEmailResponse res = (SendEmailResponse)service.Execute(req);
        #endregion
    }

比方说,我已经向帐户发送了一封电子邮件。电子邮件将显示在活动部分。如何从
SDK
检索它?

您需要执行以下任一操作:

(链接中的完整示例)

-当您已经知道记录Id时,您的案例中的电子邮件Id


-当您不知道记录Id,但要根据其他条件进行搜索时,例如,与帐户Id相关的电子邮件。

哪个SDK?您尝试过什么?crm sdk 2016。。我的意思是我创建了一个直接连接到crm的网站。知道怎么做吗?还是插件?