Here's a code snippet that will help you to update the owner of a record in a plug-in. This code should run in a POST plug-in:
SecurityPrincipal assignee = new SecurityPrincipal();
assignee.Type = SecurityPrincipalType.User;
// PrincipalId is some known Guid belonging to the user or team that will own this record.
assignee.PrincipalId = new Guid("476E234C-5E15-DE11-80BA-000C297AF856");
// Create the target object for the request.
TargetOwnedAccount target = new TargetOwnedAccount();
// Set the properties of the target object.
// EntityId is some known Guid belonging to the account that is being assigned to the user.
target.EntityId = id;
// Create the request object.
AssignRequest assign = new AssignRequest();
// Set the properties of the request object.
assign.Assignee = assignee;
assign.Target = target;
// Execute the request.
ICrmService service = context.CreateCrmService(true);
AssignResponse assignResponse = (AssignResponse)service.Execute(assign);
catch (Exception ex)
Have fun copy and pasting :)