【发布时间】:2021-01-22 06:24:30
【问题描述】:
我正在尝试将文件上传到 SharePoint Online,我得到了这个示例代码:
var uploadFile = list
.RootFolder
.Folders
.GetByPath(ResourcePath.FromDecodedUrl("A"))
.Files
.Add(newFile);
ctx.Load(uploadFile);
await ctx.ExecuteQueryAsync();
它工作得非常好,所以它周围的一切都可以工作。但显然这个sn-p
var uploadFile = list
.RootFolder
.Folders
.GetByPath(ResourcePath.FromDecodedUrl("A/B"))
.Files
.Add(newFile);
ctx.Load(uploadFile);
await ctx.ExecuteQueryAsync();
即使两个目录都存在,也会引发 System.IO.DirectoryNotFoundException。那么如何将文件上传到子目录“B”?
【问题讨论】:
标签: c# sharepoint upload csom