在调用用户集合时,Microsoft Graph API 不支持 $skip 和 $count。
虽然我知道skipToken允许您使用一些分页功能,但它限制了我的应用程序中用户页面的分页功能。
正在使用的AD租户有超过6000个用户,下载完毕需要很长时间。
我打算将它们缓存在服务器上并定期检查更新,但我想检查以确保我没有丢失任何内容。
有没有办法使用 $count 和 $skip 或我不知道的等效项?
最佳答案
The Microsoft Graph Api does not support $skip and $count for when making calls to the users collection.
没错,这是 official documentation 的摘录:
$count
is not supported for collections of resources that derive from directoryObject like collections of users or groups.
同样适用于 $skip
parameter , List users endpoint 不支持.
对于paging scenarios $skipToken
参数需要与 $top
参数一起使用。
示例
假设页面大小为 100
项,以下查询将检索第一页的用户:
GET https://graph.microsoft.com/v1.0/users?$top=100
如果结果包含超过 100 个用户,Microsoft Graph 将返回 @odata:nextLink
属性。通过发送 @odata:nextLink
属性的 url 值来检索下一页结果:
GET https://graph.microsoft.com/v1.0/users?$top=100&$skiptoken={skipToken}
关于azure - 用户 $Skip 和 $Count,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56960712/