我正在尝试通过Microsoft图形SDK(位于Onedrive中)通过获取其流来更新excel在线文件。文件关闭时,excel的更新正确发生。但同样每当文件打开时,我都无法访问文件流。
public async Task<Stream> DownloadSelectedItem(string id) {
return await graphClient
.Drive
.Items[id]
.Content
.Request()
.GetAsync();
}
public async Task<DriveItem> UploadFileToFolder(string targetFolderId, string filename, Stream stream)
{
DriveItem uploadedItem;
uploadedItem = await graphClient.Drive.Items[targetFolderId].ItemWithPath(filename).Content.Request()
.PutAsync<DriveItem>(stream);
return uploadedItem;
}
有没有办法在打开文件时获取文件流?
以下是我在文件打开时尝试更新OneDrive中的现有文件时收到的错误
Code: accessDenied
Message: Lock token does not match existing lock
Inner error
答案 0 :(得分:0)
这意味着您尝试编辑的文件已在某些浏览器中打开。您应该先关闭它,然后再打开