python-3.x - 查找“与我共享”文件夹 ID(驱动器 ID)和文件 ID - OneDrive、Microsoft Graph、Python
问题描述
我的客户与我共享了一些包含 5 个文件的 onedrive 文件夹,我想找到驱动器 ID,文件 ID,以便我可以使用 python 脚本下载,脚本参考:无法从文件夹内下载文件,OneDrive,Microsoft图形,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
但我只获取我的文件详细信息。
解决方案
您可以先调用urihttps://graph.microsoft.com/v1.0/me/drive/sharedWithMe
并获取响应数据。在响应中,我们可以找到共享文件的id
and driveId
(“driveId”在“remoteItem”->“parentReference”下)。然后使用下面的 api 下载它的内容。
https://graph.microsoft.com/v1.0/me/drives/{driveId}/items/{id}/content
推荐阅读
- javascript - 用css在滑块的中心插入图形
- sql - 使用 50 个并行 SQLPLUS 会话和 Bulk Collect LIMIT 和 FORALL 更新具有 500+ 百万条记录的表
- android - 如何更改输入反应本机的值
- python - Scrapy Mongodb 管道超时
- ironpython - Spotfire - 如何显示组合条堆叠条的标签 100%
- jasper-reports - 除了最后一次之外,如何详细打印每次迭代的文本?
- c++ - C++ 忽略 While 循环条件
- vba - Outlook 2010 新分配自动设置
- python - (Selenium) 下载和重命名文件问题
- c++ - 将相机附加到网格时找不到网格虚幻,C++