本文介绍了微软CRM,我怎么使用CrmService列表中的所有成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发,需要使用Web服务API来读取从Microsoft CRM数据的工具。

I am developing a tool that needs to read data from Microsoft CRM using the webservice API.

我需要的市场营销列表中的所有成员。我可以在系统中使用WebService所有的名单,但我不能得到一个列表的成员。这是查询我到目前为止,我可以运行,但它不返回任何成员:

I need to get all the members of a marketing list. I can get all the lists in the system using the webservice, but I can't get the members of a list. This is the query I have so far, which I can run, but it does not return any members:

QueryExpression qe = new QueryExpression();
qe.EntityName = "contact";
qe.ColumnSet = new AllColumns();

var linkContact = new LinkEntity {
    LinkFromEntityName = "contact",
    LinkFromAttributeName = "contactid",
    LinkToEntityName = "listmember",
    LinkToAttributeName = "entityid"
};

var linkList = new LinkEntity {
    LinkFromEntityName = "listmember",
    LinkFromAttributeName = "entityid",
    LinkToEntityName = "list",
    LinkToAttributeName = "listid" };

var ce = new ConditionExpression
             {
                 AttributeName = "listid",
                 Operator = ConditionOperator.Equal,
                 Values = new object[] {list.listid.Value}
             };

linkList.LinkCriteria = new FilterExpression {Conditions = new[] {ce}};
linkContact.LinkEntities = new[] {linkList};
qe.LinkEntities = new [] {linkContact};
var members = service.RetrieveMultiple(qe);
Console.WriteLine("Members of {0}:", list.listname);
Assert.IsTrue(members.BusinessEntities.Any());

foreach(contact lead in members.BusinessEntities)
    Console.WriteLine(lead.fullname);

我怎样才能获得列出使用Web服务API的成员?

How can I get the members of the list using the webservice API ?

推荐答案

我猜你可能想通了现在,但无论如何...

I'm guessing you probably figured it out by now but anyway...

var linkList = new LinkEntity {
            LinkFromEntityName = "listmember",
            LinkFromAttributeName = "listid",
            LinkToEntityName = "list",
            LinkToAttributeName = "listid" };

相关线路是:
LinkFromAttributeName =listid,与entityid

The relevant line is:
LinkFromAttributeName = "listid",versus "entityid"

这篇关于微软CRM,我怎么使用CrmService列表中的所有成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:34