Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

CRM 2011 Send email with late bound

$
0
0

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;
   service.Execute(Send);

Thanks in advance

-JB



Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>