Find the “Shared with me” Folder Id (Drive Id) and Files Id - OneDrive, Microsoft Graph, Python

你离开我真会死。 提交于 2020-06-09 05:29:17

问题


My clients shared some onedrive folder with me which contains 5 Files, I want to find the drive-Id, File-Id, so that I can download using python scripts, Script reference: Not able to download files from inside folder, OneDrive, Microsoft Graph, Python

I am trying below script:

requests.get('https://graph.microsoft.com/v1.0/me/drive/sharedWithMe', headers={'Authorization': 'Bearer ' + Access_Token}).content

requests.get('https://graph.microsoft.com/v1.0/me/drives', headers={'Authorization': 'Bearer ' + Access_Token}).content

but I am getting my files details only.


回答1:


You can call the uri https://graph.microsoft.com/v1.0/me/drive/sharedWithMe first and get the response data. In the response, we can find the id and driveId(the "driveId" is under "remoteItem" -> "parentReference") of the shared file. And then use the api below to download its content.

https://graph.microsoft.com/v1.0/me/drives/{driveId}/items/{id}/content


来源:https://stackoverflow.com/questions/61700031/find-the-shared-with-me-folder-id-drive-id-and-files-id-onedrive-microsof

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