代码:excel createSession 的 MS Graph API 的 itemNotFound 错误,我可以使用 sharedWithMe API 调用获取项目 ID
code: itemNotFound error for MS Graph API for excel createSession, I am able to get Item Id using sharedWithMe API call
我可以使用下面的调用
获得Excel文件信息
https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
sharedWithMe call screenshot
但是当我从上面的调用中获取项目 ID 并使用它来创建 excel 会话时,它确实给我以下错误:
API 调用 https://graph.microsoft.com/v1.0/me/drive/items/{ID here}/workbook/createSession
错误:
"error": {
"code": "itemNotFound",
"message": "The resource could not be found.",
"innerError": {
"date": "2021-02-17T06:18:19",
"request-id": "07639ad5-08e4-4973-9804-eb805a8bce8d",
"client-request-id": "326609a7-95dc-b36f-8db0-3b7ab2101860"
}
Error Screen
请注意:我已授予 Sites.ReadWriteAll 和 Files.ReadWriteAll 权限。
问题是共享文件存储在与您不同的驱动器上。
首先,您需要获取文件的正确驱动器 ID。
当你打电话时
https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
响应应包含 remoteItem
个节点和 parentReference
个子节点。
"@odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2021-01-05T09:51:23Z",
"id": "01BDYTYLL573DF4J3A2JG3WPFKMZLLBPQD",
...
"remoteItem": {
"id": "01BDYTYLL573DF4J3A2JG3WPFKMZLLBPQD",
"parentReference": {
"driveId": "b!RdjejBSERkqd6KyrlECzSlClLPMHvAxIle01z5BIuc0OlAR_j4bQQ5j8LT1dXapM",
"driveType": "business",
"id": "01BDYTYLN6Y2GOVW7725BZO354PWSELRRZ"
},
....
使用 driveId
和项目的 id
并调用此端点来创建 excel 会话。
POST: https://graph.microsoft.com/v1.0/drives/{driveId}/items/{id}/workbook/createSession
如果您有编辑共享文件的权限,那么调用应该会成功
我可以使用下面的调用
获得Excel文件信息https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
sharedWithMe call screenshot
但是当我从上面的调用中获取项目 ID 并使用它来创建 excel 会话时,它确实给我以下错误:
API 调用 https://graph.microsoft.com/v1.0/me/drive/items/{ID here}/workbook/createSession
错误:
"error": {
"code": "itemNotFound",
"message": "The resource could not be found.",
"innerError": {
"date": "2021-02-17T06:18:19",
"request-id": "07639ad5-08e4-4973-9804-eb805a8bce8d",
"client-request-id": "326609a7-95dc-b36f-8db0-3b7ab2101860"
}
Error Screen
请注意:我已授予 Sites.ReadWriteAll 和 Files.ReadWriteAll 权限。
问题是共享文件存储在与您不同的驱动器上。
首先,您需要获取文件的正确驱动器 ID。
当你打电话时
https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
响应应包含 remoteItem
个节点和 parentReference
个子节点。
"@odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2021-01-05T09:51:23Z",
"id": "01BDYTYLL573DF4J3A2JG3WPFKMZLLBPQD",
...
"remoteItem": {
"id": "01BDYTYLL573DF4J3A2JG3WPFKMZLLBPQD",
"parentReference": {
"driveId": "b!RdjejBSERkqd6KyrlECzSlClLPMHvAxIle01z5BIuc0OlAR_j4bQQ5j8LT1dXapM",
"driveType": "business",
"id": "01BDYTYLN6Y2GOVW7725BZO354PWSELRRZ"
},
....
使用 driveId
和项目的 id
并调用此端点来创建 excel 会话。
POST: https://graph.microsoft.com/v1.0/drives/{driveId}/items/{id}/workbook/createSession
如果您有编辑共享文件的权限,那么调用应该会成功