Skip to content

Instantly share code, notes, and snippets.

@tswann
Created September 21, 2011 13:02
Show Gist options
  • Save tswann/1231970 to your computer and use it in GitHub Desktop.
Save tswann/1231970 to your computer and use it in GitHub Desktop.
Assign contact to a new Owner.
contact.FirstName = "Tom";
// Assign record to new owner
AssignRequest assign = new AssignRequest
{
Assignee = new EntityReference(SystemUser.EntityLogicalName, newOwnerId),
Target = new EntityReference(Contact.EntityLogicalName, contact.Id)
};
_context.UpdateObject(contact);
_context.Execute(assign);
_context.SaveChanges();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment