如标题中所述,我一直在尝试使用Microsoft图形API从我们公司的Sharepoint网站中提取Excel工作簿。我能够检索文件的元数据,但是当我将/workbook/
段添加到 URL 时,我收到以下错误:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'workbook'.",
"innerError": {
"request-id": "bf41e41a-bc01-4c3b-b1d7-3125c4d48124",
"date": "2019-04-10T16:29:07"
}
}
}
以下是获取文件元数据的成功调用的样子:
https://graph.microsoft.com/v1.0/sites/{siteid}/lists/{listid}/items/273
这是我正在拨打的调用,它返回上述错误:
https://graph.microsoft.com/v1.0/sites/{siteid}/lists/{listid}/items/273/workbook/
我能够找到这个讨论类似错误的 stackoverflow 帖子,但是那是几年前的事了,显然使用的是 Graph API 的测试版,我无法使用该帖子中的建议走得更远。 使用 Microsoft Graph beta 从 SharePoint 网站获取工作簿
我正在根据阅读这两个Microsoft文档构建我的请求 URL: https://learn.microsoft.com/en-us/graph/api/resources/sharepoint?view=graph-rest-1.0 https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0
我认为这无关紧要,但我正在使用 C# 并使用 Restsharp 构建请求。
有人对此有任何见解吗?
谢谢!
不能对ListItem
使用/workbook
,只能与DriveItem
一起使用。
为此,您需要首先获取与ListItem
关联的DriveItem
:
/v1.0/sites/{siteid}/lists/{listid}/items/273/driveitem/workbook