0
当试图将文件上传到库中的sharepoint子文件夹时出现上述错误。我很确定这个网址是正确的,因为它会给出一个“文件未找到错误”,如果我改变它也一样。上传文件到子文件夹会产生错误“值不在预期的范围内”
public void UploadFile(string client, IEnumerable<FileUpload> documents)
{
foreach (var document in documents)
{
using (var context = new ClientContext(sharePointSite))
{
var listCollection = context.Web.Lists;
var list = context.Web.Lists.GetByTitle(client); //clientname
context.ExecuteQuery();
var fileCreationInformation = new FileCreationInformation()
{
Content = document.FileBytes,
Url = @"https://sharepointsite.com/sites/client/docStore/clientname/cdae2d570ab24b02811a8bce88ebea64/new1.zip",
Overwrite = true
};
var file = list.RootFolder.Files.Add(fileCreationInformation);
context.ExecuteQuery();
}
}
}
我已经从上面的代码中删除了一些东西,使它更容易阅读(文件夹创建/ netwrok凭据)。任何人都可以看到我要去哪里吗?还有更好的方法来做到这一点?我所见过的上传到子文件夹的所有解决方案都是提供文件URL。有没有一种方法可以明确上传到代码中的文件夹?