匿名上传到 OneDrive 上的公共共享文件夹

Anonymously uploading to a publicly shared folder on OneDrive

匿名上传到 OneDrive 上的公共共享文件夹的 REST API 调用是什么?

我尝试通过 OneDrive Web UI 共享一个文件夹,创建一个 link 归因于:"Anyone with this link can edit this item",并使用 REST API:

POST https://graph.microsoft.com/v1.0/drives/{driveId}/items/{sharedFolderId}/createLink
Content-type: application/json
{
    "type": "edit",
    "scope": "anonymous"
}

在这两种情况下,我都可以在不登录的情况下从共享文件夹中读取

GET https://api.onedrive.com/v1.0/shares/{shareId}/items/{sharedFolderId}

我也可以使用

读取权限本身
GET https://api.onedrive.com/v1.0/shares/{shareId}/items/{sharedFolderId}/permissions

=>

{
    "@odata.context":"https://api.onedrive.com/v1.0/$metadata#shares('{shareId}')/items('{sharedFolderId')/permissions",
    "value":
    [
        {
            "id":"{permissionId}",
            "link":
            {
                "application":
                {
                    "displayName":"{my own app}",
                    "id":"{short app id}"
                },
                "type":"edit",
                "webUrl":"https://1drv.ms/u/{shareId}"
            },
            "roles":["write"],
            "shareId":"{shareId}",
            "expirationDateTime":"0001-01-01T00:00:00Z",
            "hasPassword":false
        }
    ]
}

但是尝试上传文件或创建子文件夹,即

PUT https://api.onedrive.com/v1.0/shares/{shareId}/driveItem:/{filename}:/content
Content-type: text/plain
some text goes here

POST https://api.onedrive.com/v1.0/shares/{shareId}/items/{sharedFolderId}/children
Content-type: application/json
{
    "name": "TestFolder",
    "folder": { }
}

两者都因未授权调用而失败 - 但 "edit" link 和 "anonymous" 范围的重点不是 "anyone with this link can edit this item"?

我尝试了 https://graph.microsoft.com/v1.0 代替 https://api.onedrive.com/v1.0/drives/{driveId} 代替 /shares/{shareId} 以及 /shares/{shareToken} 的各种组合,其中 shareToken 是权限中 linkwebUrl 的 "u!" 编码。

到目前为止还没有找到正确的 REST API 调用。我希望有人能够提供帮助:-)

您可以下载我的 TestOneDrive Visual Studio 测试项目来重现问题。它还包含用于创建和共享文件夹的初始化代码。

由于没有产品组的人关注这个,也没有官方文档宣布这个,所以我建议你先在 UserVocie 上提交一个功能请求,或者投票给一个现有的接近你的问题的请求。