0

我正在尝试将成员添加到 CRM 2011 工作流活动中的营销列表。在它执行下面的代码之后,它说 fromListCreated 的成员计数是 0,而它应该是 1。我已经验证过members[0]并且AddMemberRequest.MemberIds[0]确实包含一个成员 GUID。有谁知道我错过了什么?

List fromList = new List();
List fromListCreated = new List();
fromList.CreatedFromCode = new OptionSetValue(2);
fromList.ListName = "My List";
Guid fromListGuid = service.Create(fromList);
var list = service.Retrieve("list", fromListGuid, new Microsoft.Xrm.Sdk.Query.ColumnSet(true));
fromListCreated = service.Retrieve(list.LogicalName, list.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet(true)).ToEntity<List>();

Guid emailFrom = Guid.Empty;
if (EmailFrom != null)
{
    emailFrom = EmailFrom.Get(executionContext).Id;
}
else
{
    // Default to the inhouse attorney user
    emailFrom= thisCase.lgl_inhouseattorneyid.Id;
}

Guid[] members = new Guid[1];
members[0] = emailFrom;
AddListMembersListRequest AddMemberRequest = new AddListMembersListRequest();

AddMemberRequest.ListId = fromListCreated.Id;
AddMemberRequest.MemberIds[0] = members[0];
AddListMembersListResponse AddMemberResponse = service.Execute(AddMemberRequest) as AddListMembersListResponse;
service.Update(fromListCreated);
4

1 回答 1

0

据我所知:

在 AddListMembersListRequest 之后 fromListCreated 尚未更新。任何 crm 请求都不会更新此对象。我相信这个对象应该通过检索请求更新回来。

该成员是否已添加到营销列表中?

于 2013-10-19T13:11:48.410 回答