Daily Archives: March 2, 2012

Send Email through Code using Late Bound MSCRM 2011

If you want to send mail through sdk using late bound you can use below function

 private void CreateMail(IOrganizationService service,Guid _ contactid,Guid _From)


//create activityparty

Entity Fromparty = new Entity(“activityparty”);

Entity Toparty = new Entity(“activityparty”);

 //set partyid

//You can refer http://msdn.microsoft.com/en-us/library/gg328549.aspx to get acitivity party entity attribute

Toparty[“partyid”]= new EntityReference(“contact”, _ contactid));

 Fromparty[“partyid”]= new EntityReference(“systemuser”, _From));

//create email  and set attributes

Entity _Email = new Entity(“email”);

 _Email[“from”] = new Entity[] { Fromparty };

 _Email[“to”] = new Entity[] { Toparty };

 _Email[“directioncode”] = true;

 _Email[“regardingobjectid”] = new EntityReference(“contact”, _contactid);

  Guid EmailID = service.Create(_Email);


Enjoy !!!

Leave a comment

Filed under MS CRM 2011