C# 如何向活动添加资源?

C# 如何向活动添加资源?,c#,.net,visual-studio,dynamics-crm-2011,C#,.net,Visual Studio,Dynamics Crm 2011,是否可以将资源用户/设施添加到服务约会 以下是我要添加资源的记录: var serviceAppointment = this.organizationService.Retrieve( "serviceappointment", serviceActivityGuid, new ColumnSet(true)); { "ListOfResourceIds": [ { "partyi

是否可以将资源用户/设施添加到服务约会

以下是我要添加资源的记录:

        var serviceAppointment = this.organizationService.Retrieve(
            "serviceappointment",
            serviceActivityGuid,
            new ColumnSet(true));
{
  "ListOfResourceIds": [
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D333"
    },
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D044"
    }
  ]
}
var serviceAppointment = organizationService.Retrieve(
                      "serviceappointment",
                      serviceActivityGuid,
                      new ColumnSet(true));

var updateServiceAppointment = new Entity("serviceappointment")
{
    Id = serviceAppointment.Id
};
updateServiceAppointment["resources"] = new[]
{
    new ActivityParty()
    {
        PartyId = new CrmEntityReference("systemuser", correspondingSystemUserId)
    }
};
organizationService.Update(updateServiceAppointment);
我有一份资源清单:

        var serviceAppointment = this.organizationService.Retrieve(
            "serviceappointment",
            serviceActivityGuid,
            new ColumnSet(true));
{
  "ListOfResourceIds": [
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D333"
    },
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D044"
    }
  ]
}
var serviceAppointment = organizationService.Retrieve(
                      "serviceappointment",
                      serviceActivityGuid,
                      new ColumnSet(true));

var updateServiceAppointment = new Entity("serviceappointment")
{
    Id = serviceAppointment.Id
};
updateServiceAppointment["resources"] = new[]
{
    new ActivityParty()
    {
        PartyId = new CrmEntityReference("systemuser", correspondingSystemUserId)
    }
};
organizationService.Update(updateServiceAppointment);
如何将这些资源添加到上面的ServiceAppointment

我怀疑在添加它们之后,我会调用:

        organizationService.Update(serviceAppointment);
资源属于SystemUser类型。要更新服务预约,请获取资源的相应系统用户ID:

        var serviceAppointment = this.organizationService.Retrieve(
            "serviceappointment",
            serviceActivityGuid,
            new ColumnSet(true));
{
  "ListOfResourceIds": [
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D333"
    },
    {
      "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D044"
    }
  ]
}
var serviceAppointment = organizationService.Retrieve(
                      "serviceappointment",
                      serviceActivityGuid,
                      new ColumnSet(true));

var updateServiceAppointment = new Entity("serviceappointment")
{
    Id = serviceAppointment.Id
};
updateServiceAppointment["resources"] = new[]
{
    new ActivityParty()
    {
        PartyId = new CrmEntityReference("systemuser", correspondingSystemUserId)
    }
};
organizationService.Update(updateServiceAppointment);

非常感谢你!这会抹去资源中的所有内容并替换为1 ActivityParty记录吗?