计算从 Dynamics 365 Web 中的 $extend 返回的记录 API

Count records returned from $extend in Dynamics 365 Web API

基本上,我有这样的东西:

https://company.crm.dynamics.com/api/data/v9.0/accounts?$select=accountid,accountnumber,name&$expand=crm_productbuyer($select=name)

我希望能够只计算 $expand 中返回的记录数,而不是在 C# 中对其进行反序列化并对其进行计数。只有一件事要迭代。

这对我的情况不起作用:

API $expand and &count

编辑:

这里有很多事情表明这是不可行的:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/retrieve-entity-using-web-api#retrieve-related-entities-for-an-entity-by-expanding-navigation-properties

You can’t use the /$ref or /$count path segments to return only the URI for the related entity or a count of the number of related entities.


This is a subset of the system query options described in the “11.2.4.2.1 Expand Options” section of OData Version 4.0 Part 1: Protocol Plus Errata 02. The options $skip, $count, $search, $expand and $levels aren’t supported for the Web API.

将把这个标记为答案,除非其他人插话证明不是这样。

听起来不可行:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/retrieve-entity-using-web-api#retrieve-related-entities-for-an-entity-by-expanding-navigation-properties

You can’t use the /$ref or /$count path segments to return only the URI for the related entity or a count of the number of related entities.


This is a subset of the system query options described in the “11.2.4.2.1 Expand Options” section of OData Version 4.0 Part 1: Protocol Plus Errata 02. The options $skip, $count, $search, $expand and $levels aren’t supported for the Web API.