Salesforce将活动历史记录元素添加到Lead(api).net

Salesforce将活动历史记录元素添加到Lead(api).net,.net,salesforce,.net,Salesforce,我的目标是按id查找潜在客户,并将其添加到此潜在客户活动历史记录(SendeMail类型) 我有潜在客户id和html正文(电子邮件)的列表,我需要将此电子邮件添加到潜在客户的活动历史记录中,因为它是从saleforce发送的 如何构建活动历史记录(SendeMail类型)元素,并将其添加到潜在客户中 //This what i am tried SF.QueryResult _ExistingLead = m_SalesForceReference.query("Select Lead_I

我的目标是按id查找潜在客户,并将其添加到此潜在客户活动历史记录(SendeMail类型)

我有潜在客户id和html正文(电子邮件)的列表,我需要将此电子邮件添加到潜在客户的活动历史记录中,因为它是从saleforce发送的

如何构建活动历史记录(SendeMail类型)元素,并将其添加到潜在客户中

//This what i am tried

SF.QueryResult _ExistingLead = m_SalesForceReference.query("Select  Lead_ID__c FROM Lead where Email='xxx.xx@com'");

 if (_ExistingLead.records.Count() != 0)
          {
//going throw all my leads
              foreach (SF.Lead item in _ExistingLead.records)
              {

  SF.ActivityHistory Activitymail = new SF.ActivityHistory();
  Activitymail.Id = item.Lead_ID__c;//here i added lead id to my ActivityHistory 
  Activitymail.Mobile__c = "123456";
  SF.SaveResult[] _SaveResults = m_SalesForceReference.create(new SF.sObject[] { Activitymail });
//not working
//No errors but i cant see it in the lead



                                }
                            }
我错过了什么


如何构建活动历史记录(SendeMail类型)元素,并将其添加到潜在客户中?

i count查找如何添加活动历史记录(似乎是只读元素)

但我有一种方法可以做到这一点,那就是从我的潜在客户那里发送电子邮件,并将其添加到活动历史记录中

这里是代码

 SF.Lead MyLead = (SF.Lead)_ExistingLead.records[0];
 string OwnerId = MyLead.OwnerId;
 string Contact_ID__c = MyLead.Lead_ID__c;
 SF.SingleEmailMessage mail = new SF.SingleEmailMessage();
 String[] toAddresses = new String[] { "vovaLead@dd.com" };
 mail.toAddresses = (toAddresses);
 mail.bccSender = (true);
 String[] bccAddresses = new String[] { "vovaLeadBcc@dd2.com" };
 mail.bccAddresses = (bccAddresses);
 mail.targetObjectId = (Contact_ID__c);
 mail.saveAsActivity = (true);//THIS WILL ADD THIS EMAIL TO ACTIVITY HISTORY
 mail.subject = ("some text");
 mail.plainTextBody ="some text";
 SF.SendEmailResult[] _SaveResults = m_SalesForce.sendEmail(new SF.Email[] { mail });
重要的是确保:

导航到设置>电子邮件管理>要更新的可交付性 对所有电子邮件的访问级别