Hi,
I am just updating last contacted info on contact record if inbound email contains a contact in to,cc or bcc.
For that I have registered plug-in on email DeliverPromote Pre-Event. I am using below code
if (context.PrimaryEntityName == "email")
{
if (context.PrimaryEntityId != null)
{
Entity email = service.Retrieve("email", context.PrimaryEntityId, new ColumnSet("to", "cc", "directioncode"));
if (!email.GetAttributeValue<bool>("directioncode"))
{
if (email.Contains("to"))
{
traversecollection(ref ContactIDs, email.GetAttributeValue<EntityCollection>("to"));
}
if (email.Contains("cc"))
{
traversecollection(ref ContactIDs, email.GetAttributeValue<EntityCollection>("cc"));
}
}
}
}traversecollection is just a function which extracts a ID if Entity in entity collection is of type contact. But while I track email from outlook to CRM. it just throws error "Invalid argument".
Am I doing anything wrong ?
Thanks and regards,
Hiren Solanki.
Please vote or mark as a answer if it helped you.