2

我正在为 Office 365 使用统一图形 API v1.0,当我进行如下查询时:

https://graph.microsoft.com/v1.0/me/contacts

它只返回10 个联系人。但是当我这样做时:

https://graph.microsoft.com/v1.0/me/contacts/$count

我可以看到我有94​​3 个联系人

我尝试通过执行以下操作强制 api 返回我的 943 联系人:

https://graph.microsoft.com/v1.0/me/contacts?$top=943

但我能检索到的最好的是499 个联系人。

有什么办法可以一次检索它们,如果没有,我可以用什么方式对它们进行分页?

我的文档参考是: http:
//graph.microsoft.io/docs/overview/query_parameters

http://graph.microsoft.io/docs/api-reference/v1.0/api/user_list_contacts

非常感谢你的帮助

4

1 回答 1

2

您需要使用$skipToken(Microsoft Graph 可选查询参数)对响应进行分页:

在某些响应中,您会看到一个@odata.nextLink值。其中一些包含一个$skipToken值。该$skipToken值就像一个标记,告诉服务在哪里恢复下一组结果。以下是@odata.nextLink来自响应的值的示例。

"@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$orderby=displayName&$top=3&$skiptoken=X%2783630372100000000000000000000%27"

例如,要返回组织中的下一组用户,将结果中的数量一次限制为 3 个,语法如下。

GET  https://graph.microsoft.com/v1.0/users?$orderby=displayName&$top=3&$skiptoken=X%2783630372100000000000000000000%27
于 2015-12-07T16:54:27.437 回答