Sunday, February 26, 2012

Create an Email Activity in Microsoft Dyanamics CRM 2011 Using C#

while doing so, i was just refering the "To" and "from" field on the email as general EntityReference.
While doing so, it will not throw any Exceptions, record will be created, but it will not assign the "To", "From" fields.

So EntityReferemce does not work here.
The logic is, we can have multiple values in To ( but dono why From is in same manner, even if From will have only one value always).
So it should be Array of EntityReferences.

So it uses "ActivityPointer" as follows...

Entity eActivityParty = new Entity("activityparty");
eActivityParty.Attributes.Add("partyid", new EntityReference("systemuser", "00000000-0000-0000-0000-000000000000"));
Entity[] aryFrom = { eActivityParty };
eEmail.Attributes.Add("from", aryFrom);


So, hope this will help anyone....

No comments:

Post a Comment