Dynamics 365 – Get E-mail Address of Activity Parties from SDK (RetrieveMultiple)

By using below code you can retrieve all Required and Optional Attendees of an Activity. You don’t need to specify the name of the entity. By doing it so, it allows you to use it for any of the activity entity.

public List<string> RetrieveActivityPartyEmails(IOrganizationService service)
            var activityId = new Guid("[your_activity_id]");
            List<string> emailAdresses = new List<string>();

            var activityParties = service.RetrieveMultiple(new QueryExpression("activityparty")
                ColumnSet = new ColumnSet("addressused"),
                Criteria = new FilterExpression(LogicalOperator.And)
                    Conditions =
                            new ConditionExpression("activityid", ConditionOperator.Equal, activityId)

            for (int i = 0; i < activityParties.Count; i++)//addressused
                var party = activityParties[i];

                if (party.Attributes.Contains("addressused"))

            return emailAdresses;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s