2013-10-04 65 views
0

我試圖將成員添加到CRM 2011工作流程活動中的營銷列表。它執行下面的代碼後,它是說,fromListCreated成員計數爲0,它應該是1.我已驗證members[0]AddMemberRequest.MemberIds[0]確實包含成員GUID。有誰知道我錯過了什麼?在CRM 2011工作流程活動中將成員添加到市場營銷列表

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); 
+0

看不到任何東西丟失。你收到什麼迴應? – Scorpion

回答

0

至於我可以看到:

fromListCreated尚未在AddListMembersListRequest後更新。該對象不會被任何crm請求更新。我相信這個對象應該通過檢索請求來更新。

是否已將該成員添加到營銷列表中?

相關問題