gpt4 book ai didi

onedrive - MS Graph API : microsoft. graph.createLink 未创建匿名 View 链接

转载 作者:行者123 更新时间:2023-12-03 17:41:08 24 4
gpt4 key购买 nike

我正在使用图形 API 遍历 OneDrive for Business 中的文件夹。我正在尝试使用以下调用为文件夹中的每个项目生成“匿名 View ”链接:
/v1.0/users('user-guid')/drive/items/item-id/microsoft.graph.createLink
与 body :

{
"type": "view",
"scope": "anonymous"
}

这适用于已通过 OneDrive UI 授予“查看链接 - 无需登录”权限的项目。但是,对尚未设置此共享选项的项目执行此调用会导致以下返回消息:

{
"error": {
"code": "unauthenticated",
"message": "The caller is not authenticated.",
"innerError": {
"request-id": "1c3600ec-4861-4be4-9a7b-74264f488a80",
"date": "2016-03-13T02:30:10"
}
}
}

我知道这不是身份验证问题,因为我的 token 适用于所有其他调用(以及针对已设置文件共享的项目的调用)。我从 Microsoft Graph Explorer 得到相同的行为工具。如果我在 OneDrive 中手动设置“查看链接 - 无需登录”权限,此调用将完美执行。我的 API 调用凭据与我用来在 OneDrive UI 中设置权限的凭据相同。

microsoft.graph.createLink 的文档状态

The createLink method will create a new sharing link if the specified link type doesn't already exist. If a sharing link of the specified type already exists for the app, the existing sharing link will be returned.



任何想法这里出了什么问题?

最佳答案

url应该只是 /createLink (没有 microsoft.graph 前缀):
POST /me/drive/items/{item-id}/createLink

关于onedrive - MS Graph API : microsoft. graph.createLink 未创建匿名 View 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35965886/

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