【问题标题】:Find the "Shared with me" Folder Id (Drive Id) and Files Id - OneDrive, Microsoft Graph, Python在 OneDrive、Microsoft Graph、Python 中查找“与我共享”文件夹 ID(驱动器 ID)和文件
【发布时间】:2020-08-25 05:49:26
【问题描述】:

我的客户与我共享了一些包含 5 个文件的 onedrive 文件夹,我想找到驱动器 ID,文件 ID,以便我可以使用 python 脚本下载,脚本参考: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

但我只获取我的文件详细信息。

【问题讨论】:

    标签: python-3.x python-requests azure-active-directory microsoft-graph-api onedrive


    【解决方案1】:

    可以先调用urihttps://graph.microsoft.com/v1.0/me/drive/sharedWithMe,获取响应数据。在响应中,我们可以找到共享文件的iddriveId(“driveId”在“remoteItem”->“parentReference”下)。然后使用下面的api下载它的内容。

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

    【讨论】:

    • 感谢您的回复,但我的值是空白的 ("value":[]): b'{"@odata.context":"graph.microsoft.com/v1.0/…}'
    • @SPy 你请求了哪个api来获取空白值?
    • 它是从其他域共享的,而不是在同一个域中,就像客户将文件共享给他们的合作伙伴
    • @SPy 你能在浏览器中看到你onedrive中的共享文件“与我共享”吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-22
    • 1970-01-01
    相关资源
    最近更新 更多