Dynamics crm Dynamics CRM-如何获得超过5000个元素的fetchXml查询的第二页?

Dynamics crm Dynamics CRM-如何获得超过5000个元素的fetchXml查询的第二页?,dynamics-crm,fetchxml,Dynamics Crm,Fetchxml,我对Dynamics CRM 2016和fetchXml有一个小问题。在CRM中,我有大约3.5万名用户。由于Dynamics似乎被限制为每轮最多检索5000个元素,因此我需要使用pagingCookie功能来检索第二个页面,以此类推。例如,要检索这些记录的第二页(从用户5001到10000),我必须首先检索从1到5000的用户,获取分页cookie,然后使用此cookie重新启动进程 我的问题是:这需要总共获得10000个用户,而我可能只是对第二个页面感兴趣,而不是第一个页面。有没有直接的方法

我对Dynamics CRM 2016和fetchXml有一个小问题。在CRM中,我有大约3.5万名用户。由于Dynamics似乎被限制为每轮最多检索5000个元素,因此我需要使用pagingCookie功能来检索第二个页面,以此类推。例如,要检索这些记录的第二页(从用户5001到10000),我必须首先检索从1到5000的用户,获取分页cookie,然后使用此cookie重新启动进程

我的问题是:这需要总共获得10000个用户,而我可能只是对第二个页面感兴趣,而不是第一个页面。有没有直接的方法可以在没有pagingCookie的情况下获得第二页的结果


谢谢

您好,要获得所有结果,您需要在每次呼叫crm后增加页数并添加到列表中。我不知道您正在编程的语言是什么,但我在.net中给您举了一个例子,我进行了测试并正在工作。如果需要,在javascript中也是这样

 public IEnumerable<Account> GetAllClients()
        {
            List<Account> listAccounts = new List<Account>();
            int pageIndex = 1;
            int pageSize = 1000;


            while (true)
            {
                // FETCH CLIENTES
                var Fetch = "<fetch version='1.0' page='" + pageIndex + "' count='" + pageSize + "' output-format='xml-platform' mapping='logical' distinct='true'>";
                Fetch += "<entity name='account'>";
                //Attributes
                Fetch += "<attribute name='accountid' />";
                Fetch += "<attribute name='name' />";
                Fetch += "<attribute name='accountnumber' />";
                Fetch += "<attribute name='accountid' />";
                Fetch += "<order attribute='name' descending='false' />";
                Fetch += "</entity>";
                Fetch += "</fetch>";

                EntityCollection resultClient = this.crmService.RetrieveMultiple(new FetchExpression(Fetch));

                foreach (Account c in resultClient.Entities)
                {
                    listAccounts.Add(c);
                }
                if (resultClient.MoreRecords)
                {
                    // Increment the page number to retrieve the next page.
                    pageIndex++;
                }
                else
                {
                    // If no more records in the result nodes, exit the loop.
                    break;
                }
            }

            return listAccounts;
        }
public IEnumerable GetAllClient()
{
List LISTCOUNTS=新列表();
int pageIndex=1;
int pageSize=1000;
while(true)
{
//招揽客户
var Fetch=“”;
取数+=“”;
//属性
取数+=“”;
取数+=“”;
取数+=“”;
取数+=“”;
取数+=“”;
取数+=“”;
取数+=“”;
EntityCollection resultClient=this.crmService.RetrieveMultiple(新的FetchExpression(Fetch));
foreach(resultClient.Entities中的帐户c)
{
增加(c);
}
if(resultClient.MoreRecords)
{
//增加页码以检索下一页。
pageIndex++;
}
其他的
{
//如果结果节点中没有更多记录,则退出循环。
打破
}
}
返回列表帐户;
}

干杯

我想这里的关键点是,你根本不需要使用分页cookie,你可以直接跳到第二页,通过
pageIndex=2
是的,很抱歉我实际上是在找你文章的第一部分。如果你只想把第二部分像你说的那样放在页面索引上的固定数字上,这会跟踪每个记录。