首页 > 解决方案 > 计算 Dynamics CRM Online web api (ODATA) 中的所有行

问题描述

是否可以计算给定实体中的所有行,绕过 5000 行限制并绕过页面大小限制?

我不想在一个请求中返回超过 5000 行,而只想要该给定实体中所有行的计数。

根据 Microsoft 的说法,您不能在请求 URI 中执行此操作:

The count value does not represent the total number of entities in the system. 

It is limited by the maximum number of entities that can be returned.

我试过这个:

GET [Organization URI]/api/data/v9.0/accounts/?$count=true

还有什么办法吗?

标签: odatadynamics-crmdynamics-crm-onlinedynamics-crm-365dynamics-crm-webapi

解决方案


使用函数RetrieveTotalRecordCount

如果要检索超过 5000 条实体的记录总数,请使用 RetrieveTotalRecordCount 函数。

您的查询将如下所示:

https://<your api url>/RetrieveTotalRecordCount(EntityNames=['accounts'])

推荐阅读