MS-CRM 2013 Invalid Participant Object 9
I want to send an email notification after creating a contact in CRM.
To do this, I wrote the following code ... but it throws an "Invalid member of type 9" type exception. I searched for it but didn’t find any reasonable help
thank
code:
//Defining Activity Parties (starts) Entity Fromparty = new Entity("activityparty"); Entity Toparty = new Entity("activityparty"); //set partyid Toparty["partyid"] = new EntityReference("contact", ContactGuid.Id); Fromparty["partyid"] = new EntityReference("team", ConsumerTeam.Id); //create email entity Entity Email = new Entity("email"); Email["from"] = new Entity[] { Fromparty }; Email["to"] = new Entity[] { Toparty }; Email["subject"] = "Account Login Information"; Email["description"] = PopulateBody(UserName,Password); Email["directioncode"] = true; Email["regardingobjectid"] = new EntityReference("contact", ContactGuid.Id); Guid EmailID = Service.Create(Email); //Sending email SendEmailRequest reqSendEmail = new SendEmailRequest(); reqSendEmail.EmailId = EmailID;//ID of created mail reqSendEmail.TrackingToken = ""; reqSendEmail.IssueSend = true; SendEmailResponse res = (SendEmailResponse)Common.Common.Execute(reqSendEmail);
source to share
You are trying to set an attribute of an from
object Email
to Team
. This is not possible because the attribute from
can only be user
either queue
:
You get Invalid Party object type 9
because 9 is the entity code for the object Team
.
Change your code to set from
as user or queue entry.
source to share