我们最近看到了我们认为在进行/ drive调用时有关使用top和skip查询参数的功能更改。
示例电话是:
https://graph.microsoft.com/v1.0/sites/{siteid}/drives?top=1&skip=2
这会导致错误消息:
{
"error": {
"code": "invalidRequest",
"message": "$skip is not supported on this API. Only URLs returned by the API can be used to page.",
"innerError": {
"request-id": "14be8885-c3ba-48cc-862b-169dc2c02792",
"date": "2017-08-22T21:15:44"
}
}
}
我们正在尝试获取网站集的文档库列表。我们希望能够浏览它们。这不是正确的方法吗?
我理解skipToken的概念存在,但在使用top查询参数限制此调用时不会收到。
返回3项:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:42:33Z",
"description": "This library contains administrator-approved form templates that were activated to this site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoWizkgpZiHkQpkllC4-bnhA",
"lastModifiedDateTime": "2017-07-25T05:42:33Z",
"name": "Form Templates",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/FormServerTemplates",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:53Z",
"description": "This system library was created by the PointPublishing feature to store stories that are used throughout the site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoVz8ZvkSRbdTYvi75sQq3Tt",
"lastModifiedDateTime": "2017-07-25T05:41:53Z",
"name": "Pages",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/pPg",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:59Z",
"description": "This system library was created by the PointPublishing feature to store settings that are used throughout the site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoU_AWZq16MrSLjg0Cv0MA8_",
"lastModifiedDateTime": "2017-07-25T05:41:59Z",
"name": "Settings",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/pSet",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
},
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:41:43Z",
"description": "Use the style library to store style sheets, such as CSS or XSL files. The style sheets in this gallery can be used by this site or any of its subsites.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoUmZuKEP6ZjQ75eVvVinqIN",
"lastModifiedDateTime": "2017-07-25T05:41:47Z",
"name": "Style Library",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/Style%20Library",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
]
}
当我使用top查询参数时,例如:
我只收到一个结果,无法登录其他人。
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"createdDateTime": "2017-07-25T05:42:33Z",
"description": "This library contains administrator-approved form templates that were activated to this site collection.",
"id": "b!m_Ti0EzkpkOAEcAFFWZgdxVf5QWERT1Ov1zdQWS3ZoWizkgpZiHkQpkllC4-bnhA",
"lastModifiedDateTime": "2017-07-25T05:42:33Z",
"name": "Form Templates",
"webUrl": "https://muskpartners.sharepoint.com/portals/Community/FormServerTemplates",
"driveType": "documentLibrary",
"quota": {
"deleted": 0,
"remaining": 0,
"total": 0,
"used": 0
}
}
]
}
如果skipToken是我应该寻找的,那么在这种情况下不会返回它是一个错误吗?
答案 0 :(得分:0)
并非所有端点都支持所有ODATA参数,例如/drives
端点不支持$skip
参数。您正在寻找的是$skipToken
。
$top
参数设置页面大小。如果您对API的调用有其他结果(在这种情况下是更多的驱动器),那么结果将包含skipToken
值。将该令牌传递到API将获取下一页结果(如果有更多数据,则会获取另一个skipToken
)。
https://graph.microsoft.com/v1.0/sites/{siteId}/drives?$top=1&$skiptoken={skipToken}
您可以在Paging Microsoft Graph data in your app下阅读有关使用此参数的信息。