我使用OneDrive API上传并获得共享(嵌入)链接:
POST /drive/items/{item-id}/action.createLink
Content-Type: application/json
Authorization: Bearer {access token}
{
"type": "view"
}
收到的文件包含可能对所有人都可见的链接,如“ https://onedrive.live.com/redir?resid=5D33DD65C6932946!70859&authkey=!AL7N1QAfSWcjNU8&ithint=folder%2cgif
”
但现在我正在尝试将OneDrive用于业务API:
POST https://{tenant}-my.sharepoint.com/_api/v2.0/drive/items/{file-id}/action.createLink
Content-Type: application/json
Authorization: Bearer {access token}
{
"type": "view"
}
它回来了
401 Unauthorized
error: {
code: "unauthenticated"
message: "The caller is not authenticated."
}
此外,我在https://msdn.microsoft.com/en-us/office/office365/api/files-rest-operations#Fileoperations上为v1.0业务API搜索了此功能,但总共有 nothing about sharing files .
P.S:与 getting metadata, uploading file, removing file 相关的所有操作都适用于"OneDrive for business"的两个API版本 .
我想知道是否使用OneDrive甚至可以帮助我存储一些文件并获取公共嵌入链接...
P.P.S:我正在使用HttpClient对象来使用原生REST API,但我不认为这个问题在我身边......
1 回答
它现在正在工作,似乎在API方面存在一些问题