我正在使用this在 Web API 中使用 Fetch XML 进行分页的方法。
当我们使用简单的获取时,Web API 工作得很好,如果有更多记录,它会返回分页 cookie 和结果,但是当我们使用复杂(有链接实体)获取 XML 时,它会返回分页 cookie 但为空,例如:
<b><cookie pagenumber="2" pagingcookie="" istracking="False" /></b>
在这里您可以看到 pagingcookie 中没有任何内容。
获取用于查询的 XML:
<fetch mapping="logical" version="1.0" output-format="xml-platform" count="10" page="1" >
<entity name="invoicedetail" >
<attribute name="invoicedetailid" />
<attribute name="uomid" />
<attribute name="quantity" />
<attribute name="manualdiscountamount" />
<attribute name="priceperunit" />
<attribute name="extendedamount" />
<filter>
<condition entityname="invoice" attribute="customerid" operator="eq" value="{5A8F8B46-2443-E511-80E3-3863BB351E10}" />
</filter>
<link-entity name="invoice" from="invoiceid" to="invoiceid" >
<attribute name="invoiceid" />
<attribute name="invoicenumber" />
<attribute name="description" />
<attribute name="totalamount" />
<order attribute="ss_postingdate" descending="true" />
</link-entity>
</entity>
</fetch>
如果我们删除链接实体,它就会开始在响应中提供准确的分页 cookie,可以使用 @Microsoft.Dynamics.CRM.fetchxmlpagingcookie
获取该信息。 。
有没有办法在复杂场景下获取准确的分页cookie?
最佳答案
我以前在标准组织服务中见过这种情况。我建议只进行分页而不使用分页 cookie - 这解决了我在组织服务中的问题。
例如<fetch mapping="logical" page="1" count="50">
关于api - 使用 Web API Dynamics 365 执行获取 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41262772/