CRM 2011 Activity Party Add, Remove, Delete from code

Sometimes we want to append the activity party list, update particular item in the existing activity party list, or remove specific activity party from the list.

Below is what I discovered on how to do this. Since we can't use the Create/Update/Delete method from the service context on ActivityParty entity, we need to alter the content of the list before attaching to the Activity Field.

In my case I have an ActivityRecipient custom entity that have N:1 to Email entity. Whenever the user add/update/delete this custom entity, the corresponding 'To' recipients gets updated as well.

I use this function in my pre create/update/delete message of my ActivityRecipient entity.

Note: for some reason Recurring Appointment doesn't like Organization Service Context (early bound), therefore we have to use IOrganizationService with Retrieve Request.

Hope this helps,