gpt4 book ai didi

sharepoint - 使用 Microsoft Graph API 下载 Sharepoint 文件未显示内容属性

转载 作者:行者123 更新时间:2023-12-04 00:28:00 30 4
gpt4 key购买 nike

我正在尝试使用 Microsoft Graph API 从 SharePoint Online 下载文件。
Graph API 不允许我使用/Content。

这是我正在使用的端点:

https://graph.microsoft.com/v1.0/sites/<host.sharepoint.com>/lists/<ListID>/items/<ItemID>

这就是得到(值已删除):
{
"@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"
}

}

当我尝试添加/content 时,我得到:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'content'.",
"innerError": {
"request-id": "<ReqID>",
"date": "<date>"
}
}

}

如何使用 API 下载此文件?

最佳答案

端点 https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}返回 ListItem resource但是 Content DriveItem resource 的属性(property)哪一个

Represents an item within a drive, like a document, photo, video, or folder resource



这就是发生此错误的原因。

鉴于提供的端点,它可以修改为
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem/content

download a content

关于sharepoint - 使用 Microsoft Graph API 下载 Sharepoint 文件未显示内容属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54769894/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com