Example: The Email entity has a From property that is an EntityCollection of ActivityParty entities. Same goes for the To property btw.

The following sample snippet will set the Email entity’s From address to a Queue entity using late binding:

Entity fromEntity = new Entity("activityparty");
fromEntity.Attributes["addressused"] = fromQueue.EMailAddress; //Optional
fromEntity.Attributes["partyid"] = new EntityReference(Queue.EntityLogicalName, fromQueue.Id);

record.Attributes["from"] = new Entity[] { fromEntity };