Yu-*_*-uF 3 sharepoint sharepoint-online postman microsoft-graph-api
我正在尝试使用 Microsoft Graph API 从 SharePoint Online 下载文件。Graph API 不允许我使用 /Content。
这是我正在使用的端点:
https://graph.microsoft.com/v1.0/sites/<host.sharepoint.com>/lists/<ListID>/items/<ItemID>
Run Code Online (Sandbox Code Playgroud)
这就是得到(值已删除):
{
"@odata.context","@odata.etag","createdDateTime","eTag","id","lastModifiedDateTime","webUrl","createdBy"{"user": {"email","id","displayName"}}, "lastModifiedBy": {"user": {"email","id","displayName"}},
"parentReference": {"id"},
"contentType": {"id"},
"fields@odata.context",
"fields": {"@odata.etag","FileLeafRef","id","ContentType","Created", "AuthorLookupId","Modified","EditorLookupId","_CheckinComment", "LinkFilenameNoMenu","LinkFilename","DocIcon","FileSizeDisplay", "ItemChildCount","FolderChildCount","_ComplianceFlags","_ComplianceTag", "_ComplianceTagWrittenTime","_ComplianceTagUserId","_CommentCount", "_LikeCount","Edit","_UIVersionString","ParentVersionStringLookupId", "ParentLeafNameLookupId"
}
Run Code Online (Sandbox Code Playgroud)
}
当我尝试添加 /content 时,我得到:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'content'.",
"innerError": {
"request-id": "<ReqID>",
"date": "<date>"
}
}
Run Code Online (Sandbox Code Playgroud)
}
如何使用 API 下载此文件?
端点https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}返回ListItem的资源却Content是一个性质DriveItem的资源,其
表示驱动器中的项目,如文档、照片、视频或文件夹资源
这就是发生此错误的原因。
鉴于提供的端点,它可以修改为
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/content
Run Code Online (Sandbox Code Playgroud)
以下载内容
| 归档时间: |
|
| 查看次数: |
4124 次 |
| 最近记录: |