找到“与我共享"文件夹ID(驱动器ID)和文件ID-OneDrive,Microsoft Graph,Python [英] Find the "Shared with me" Folder Id (Drive Id) and Files Id - OneDrive, Microsoft Graph, Python
问题描述
我的客户与我共享了一个包含5个文件的onedrive文件夹,我想找到drive-Id,File-Id,以便可以使用python脚本(脚本参考)进行下载:
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.
推荐答案
您可以先调用uri https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
并获取响应数据.在响应中,我们可以找到共享文件的id
和driveId
("driveId"在"remoteItem"->"parentReference"下).然后使用下面的api下载其内容.
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
这篇关于找到“与我共享"文件夹ID(驱动器ID)和文件ID-OneDrive,Microsoft Graph,Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!