Issues getting drive information when using the Graph API with a server relative O365 url

我怕爱的太早我们不能终老 提交于 2020-05-17 06:24:07

问题


I'm trying to download a file located in a M365 site via the Graph API. If I reference the site via "hostname,siteID,webID", the request works via HttpClient, the Graph API SDK and Graph Explorer:

https://graph.microsoft.com:443/v1.0/sites/hostname.sharepoint.com,fe0f6782-2cc6-447a-938f-bf6a379ed791,133e22cf-9a72-4ff2-a700-c0accacdcc8d/lists/Documents/drive/items/017TIGYVRADE3TAWYAQZBI3ET6GTHX77QO/content

If I try to reference the site via the site relative URL method, the request fails if there is information beyond the "drive" part of the URL:

https://graph.microsoft.com:443/v1.0/sites/hostname.sharepoint.com:/sites/MySiteCollection:/lists/Documents/drive/items/017TIGYVRADE3TAWYAQZBI3ET6GTHX77QO/content

ServiceException: Code: BadRequest Message: Url specified is invalid. Inner error: AdditionalData: request-id: d897756c-f135-4ac2-85e3-454e8a8fd627 date: 2020-05-04T14:47:07 ClientRequestId: d897756c-f135-4ac2-85e3-454e8a8fd627

The query works fine until just after expressing the "Documents" list as a Drive.

This works: https://graph.microsoft.com:443/v1.0/sites/hostname.sharepoint.com:/sites/MySiteCollection:/lists/Documents/drive
This doesn't work: https://graph.microsoft.com:443/v1.0/sites/hostname.sharepoint.com:/sites/MySiteCollection:/lists/Documents/drive/

Why doesn't the server relative URL method of accessing a site work?

来源:https://stackoverflow.com/questions/61597024/issues-getting-drive-information-when-using-the-graph-api-with-a-server-relative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!