Can I update the owner id of a Contact using LINQ?

前端 未结 1 1405
盖世英雄少女心
盖世英雄少女心 2020-12-10 16:08

I\'m using CRM 2011, and attempting to update the OwnerId of contact using this code:

var crmContext = new CustomCrmContext(service);

var contact = crmConte         


        
相关标签:
1条回答
  • 2020-12-10 16:36

    The owner of a record cannot be modified with an update. You have to send a AssignRequest instead.

    // Create the Request Object and Set the Request Object's Properties
    var request = new AssignRequest
    {
        Assignee = new EntityReference(SystemUser.EntityLogicalName, _newOwnerId),
        Target = new EntityReference(Account.EntityLogicalName,  _accountId)
    };
    
    
    // Execute the Request
    _service.Execute(request);
    
    0 讨论(0)
提交回复
热议问题