找到“与我共享"文件夹 ID(驱动器 ID)和文件 ID - OneDrive、Microsoft Graph、Python [英] Find the "Shared with me" Folder Id (Drive Id) and Files Id - OneDrive, Microsoft Graph, Python

查看:22
本文介绍了找到“与我共享"文件夹 ID(驱动器 ID)和文件 ID - OneDrive、Microsoft Graph、Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户与我共享了一些包含 5 个文件的 onedrive 文件夹,我想找到驱动器 ID,文件 ID,以便我可以使用 python 脚本下载,脚本参考:无法从内部文件夹、OneDrive、Microsoft Graph 下载文件, 蟒蛇

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

我正在尝试以下脚本:

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获取响应数据.在响应中,我们可以找到共享文件的iddriveId(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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆