无法使用图形 API 在共享驱动器项/驱动器项资源中找到工作簿关系Microsoft



使用Microsoft图形 API,我能够通过https://graph.microsoft.com/v1.0/me/drive/items/{id}/从存储在我的企业 OneDrive 上的驱动器项中获取工作簿资源。

但是,如果其他用户将工作簿共享给组织,并且我通过https://graph.microsoft.com/v1.0/shares/{EncodedSharingURL}/driveitem/访问它,则无法获取工作簿资源。

尝试访问共享云端硬盘项的工作簿时,响应如下:

"message": "Unable to find target address"

在这两种情况下,驱动器项返回的 JSON 看起来非常相似。它有什么不同?

要直接访问文件,您需要驱动器ID和文件ID,其中包含 https://graph.microsoft.com/v1.0/shares/{EncodedSharingURL}/driveitem/response:

驱动器 ID = 驱动器项。ParentReference.DriveId

文件编号 = driveitem.ParentReference.Id

像这样使用它: https://graph.microsoft.com/v1.0/drives(驱动器 ID(/项目(文件 ID(/工作簿/工作表

在这里: https://learn.microsoft.com/en-us/graph/api/drive-sharedwithme?view=graph-rest-1.0&tabs=http#remarks

最新更新