无法获取特定 drive/onedrive 的项目

Not able to get the items for a particular drive/onedrive

我使用

从 Microsoft Teams 生成的 SharePoint 站点列表中获得了一个驱动器 id
https://graph.microsoft.com/v1.0/groups/group-id/sites/root/lists/list-id/drive

我可以通过调用成功获取驱动器的详细信息:

https://graph.microsoft.com/beta/drives/drive-id

但是,我在尝试获取驱动器的项目时收到无效请求错误

https://graph.microsoft.com/beta/drives/drive-id/items

{
    "error": {
        "code": "invalidRequest",
        "message": "The request is malformed or incorrect.",
        "innerError": {
            "request-id": "0d83a954-ed79-4a4a-ae28-f963db4b6f2f",
            "date": "2018-03-26T05:10:37"
        }
    }
}

尝试使用/root/delta

https://graph.microsoft.com/beta/drives/drive id/root/delta

你的 URI 有点不对。引用特定 DriveItem(即 /drives/{id}/items/{id})时,您只能使用 items 路径。

如果您要在驱动器中查找 DriveItem 资源的集合,则需要调用 /drives/{driveId}/{path}/children{path} 是您要从中检索 DriveItem 资源目录的文件夹。对于 "root" 目录,您可以简单地使用 root:

https://graph.microsoft.com/v1.0/drives/{driveId}/root/children

此外,您通常不应使用 beta 版本的 Microsoft Graph。它可以在没有警告的情况下经历重大变化(并且确实如此)。生产使用不安全。