【发布时间】:2019-02-21 17:24:40
【问题描述】:
我正在尝试使用 c# 将视频上传到 SharePoint 2013 文档库,每次代码运行时我都会收到“找不到文件”异常,它只会引发 .mp4 文件的错误。如果我为此上传 jpg 或任何其他文件格式,它将起作用。我究竟做错了什么?提前感谢您的帮助。
string result = string.Empty;
try
{
//site url
ClientContext context = new ClientContext("siturl");
// The SharePoint web at the URL.
Web web = context.Web;
FileCreationInformation newFile = new FileCreationInformation();
newFile.Content = System.IO.File.ReadAllBytes(@"C:\test.mp4");
newFile.Url = "test.mp4";
List docs = web.Lists.GetByTitle("Learning Materials2");
Microsoft.SharePoint.Client.File uploadFile = docs.RootFolder.Files.Add(newFile);
context.Load(uploadFile);
context.ExecuteQuery();
}catch(Exception Ex)
{
}
UPADTE 创建了一个库,供人们下载,用于上传.mp4 https://github.com/bikecrazyy/sharepoint-library-uploader
【问题讨论】:
标签: c# .net sharepoint-2013