{"id":681,"date":"2012-03-02T07:27:17","date_gmt":"2012-03-02T07:27:17","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=681"},"modified":"2012-03-02T07:27:17","modified_gmt":"2012-03-02T07:27:17","slug":"send-email-through-code-using-late-bound","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=681","title":{"rendered":"Send Email through Code using Late Bound MSCRM 2011"},"content":{"rendered":"<p>If you want to send mail through sdk\u00a0using late bound you can use below function<\/p>\n<p>\u00a0private void CreateMail(IOrganizationService service,Guid _ contactid,Guid _From)<\/p>\n<p>{<\/p>\n<p>\/\/create activityparty<\/p>\n<p>Entity Fromparty = new Entity(&#8220;activityparty&#8221;);<\/p>\n<p>Entity Toparty = new Entity(&#8220;activityparty&#8221;);<\/p>\n<p>\u00a0\/\/set partyid<\/p>\n<p>\/\/You can refer <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/gg328549.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/gg328549.aspx<\/a> to get acitivity party entity attribute<\/p>\n<p>Toparty[\u201cpartyid&#8221;]= new EntityReference(&#8220;contact&#8221;, _ contactid));<\/p>\n<p>\u00a0Fromparty[&#8220;partyid&#8221;]= new EntityReference(&#8220;systemuser&#8221;, _From));<\/p>\n<p>\/\/create email\u00a0 and set attributes<\/p>\n<p>Entity _Email = new Entity(&#8220;email&#8221;);<\/p>\n<p>\u00a0_Email[&#8220;from&#8221;] = new Entity[] { Fromparty };<\/p>\n<p>\u00a0_Email[&#8220;to&#8221;] = new Entity[] { Toparty };<\/p>\n<p>\u00a0_Email[&#8220;directioncode&#8221;] = true;<\/p>\n<p>\u00a0_Email[&#8220;regardingobjectid&#8221;] = new EntityReference(&#8220;contact&#8221;, _contactid);<\/p>\n<p>\u00a0\u00a0Guid EmailID = service.Create(_Email);<\/p>\n<p>}<\/p>\n<p>Enjoy !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to send mail through sdk\u00a0using late bound you can use below function \u00a0private void CreateMail(IOrganizationService service,Guid _ contactid,Guid _From) { \/\/create activityparty Entity Fromparty = new Entity(&#8220;activityparty&#8221;); Entity Toparty = new Entity(&#8220;activityparty&#8221;); \u00a0\/\/set partyid \/\/You can refer http:\/\/msdn.microsoft.com\/en-us\/library\/gg328549.aspx to get acitivity party entity attribute Toparty[\u201cpartyid&#8221;]= new EntityReference(&#8220;contact&#8221;, _ contactid)); \u00a0Fromparty[&#8220;partyid&#8221;]= new EntityReference(&#8220;systemuser&#8221;, _From)); \/\/create email\u00a0 and set&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=681\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/681"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=681"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/681\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}