"DeferCommit was set to false for this upload session" 错误
"DeferCommit was set to false for this upload session" Error
我正在尝试实施 Upload large files with an upload session。
现在我有(获取上传会话):
UploadSession uploadSession = await graphClient
.Users["user3@myComp.onmicrosoft.com"]
.Drive
.Root
.ItemWithPath(@"\someFolder\file.txt")
.CreateUploadSession()
.Request()
.PostAsync();
此请求的响应是某个会话 URL,但是当我将文件块上传到此 URL 时,出现错误:
{
"error": {
"code": "invalidRequest",
"message": "DeferCommit was set to false for this upload session."
}
}
有谁知道导致此错误的原因吗?
没有看到上传字节的请求是如何发出的,我只能猜测一点 - 但我相信问题是你使用了 POST
而不是 PUT
。返回的 session URL 需要向其发出 PUT
请求,并使用适当的 Content-Range
headers,以便上传和提交数据。
我正在尝试实施 Upload large files with an upload session。
现在我有(获取上传会话):
UploadSession uploadSession = await graphClient
.Users["user3@myComp.onmicrosoft.com"]
.Drive
.Root
.ItemWithPath(@"\someFolder\file.txt")
.CreateUploadSession()
.Request()
.PostAsync();
此请求的响应是某个会话 URL,但是当我将文件块上传到此 URL 时,出现错误:
{
"error": {
"code": "invalidRequest",
"message": "DeferCommit was set to false for this upload session."
}
}
有谁知道导致此错误的原因吗?
没有看到上传字节的请求是如何发出的,我只能猜测一点 - 但我相信问题是你使用了 POST
而不是 PUT
。返回的 session URL 需要向其发出 PUT
请求,并使用适当的 Content-Range
headers,以便上传和提交数据。