Can Dynamics Crm PartyList store an emailaddress

326 Views Asked by At

I have fields in activity form for email. It contains "to, cc and bcc" fields that are all fields of the type PartyList

The question is: Can I only store entity values like contact or account or can I also just store a email address which is not associated to any contact or account in the system?

Here is a picture explaining what I'm trying to achieve

enter image description here

1

There are 1 best solutions below

1
On

As per this article it appears that the answer is yes via the addressUsed field.

Entity email = _sdk.Retrieve("email", emailId, new ColumnSet("to"));

EntityCollection to = email.GetAttributeValue<EntityCollection>("to");
if (to != null)
{
    to.Entities.ToList().ForEach(party =>
    {
        EntityReference partyId = party.GetAttributeValue<EntityReference>("partyid");
        bool isDeleted = party.GetAttributeValue<bool>("ispartydeleted");
        string addressUsed = party.GetAttributeValue<string>("addressused");

        // Do something...
    });
}