CRM 2011 Send email with late bound RRS feed

  • Question

  • Hi Forum,

    I have a requirement where I have to send email using SDK when new project(custom entity) is created in CRM.

    Email 'From' and 'To' are both our company emails but are not CRM users/contacts/Leads.

    I have written below code but it gives me error which says "partyobjecttypecode can not be null".

    This is I guess about not setting 'to' and 'from' field properly. Can someone please suggest correct way of setting this

    fields using latebound method. We are using CRM 2011 on-premise.

       Entity Fromparty = new Entity("activityparty");
       Entity Toparty = new Entity("activityparty");
       Toparty["partyid"] =  "support@mycomany.com";
       Fromparty["partyid"] = "Admin@mycomany.com";
       Entity Email = new Entity("email");
       Email["to"] = new Entity[] { Toparty };
       Email["from"] = new Entity[] { Fromparty };
       Email["subject"] = "New Project Created"
       Email["description"] = 'Some description'
       Email["directioncode"] = true;
       Guid EmailID = service.Create(Email);
       SendEmailRequest Send = new SendEmailRequest();
       Send.EmailId = EmailID;
       Send.IssueSend = true;

    Thanks in advance


    • Edited by CRM Thirsty Friday, August 28, 2015 1:23 AM
    Friday, August 28, 2015 1:22 AM


All replies