我正在尝试使用 Microsoft Graph API 从 SharePoint 文档库中获取文件夹和文档。
如果我GET
请求https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/MyDocumentSite:/drives/
,我会得到这个:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value":[
{
"createdDateTime": "2019-09-05T07:09:49Z",
"description": "",
"id": "b!wxh2ZWwoT0KKTdLRYjD5jvzjo8jkat5LgY3VyfgEqkv3YVg_XXXXXXXXXXXXXXXX",
"lastModifiedDateTime": "2019-09-05T07:09:49Z",
"name": "Documents",
"webUrl": "https://mysite.sharepoint.com/sites/MyDocumentSite/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy":{"user":{"displayName": "System Account" }},
"lastModifiedBy":{"user":{"email": "me@myorganization.org", "id": "73f9990c-5c92-4839-8b13-XXXXXXXXXXXX", "displayName": "John Smith"…},
"quota":{"deleted": 0, "remaining": 0, "total": 0, "used": 0}
}
]
}
但是,如果我尝试通过GET
对该 id: 发出请求来访问该驱动器,则会https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/MyDocumentSite:/drives/b!wxh2ZWwoT0KKTdLRYjD5jvzjo8jkat5LgY3VyfgEqkv3YVg_XXXXXXXXXXXXXXXX
收到 BadRequest 错误:
{
"error":{
"code": "BadRequest",
"message": "Url specified is invalid.",
"innerError":{
"request-id": "7c9eaf61-764f-4d72-abdb-ffa2fe868e90",
"date": "2019-09-16T19:09:41"
}
}
}
最终,我想要一种方法来显示文档库中的所有文件夹和文档,但我似乎无法通过这个初始步骤。