I'm trying to upload video using c# to SharePoint 2013 document library, every time the code runs I get a "file not found" exception, it only throws errors with .mp4 files. If I upload a jpg or any other file format for that matter it will work. What am I doing wrong? Thanks in advance for the help.
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 Created a library, for people to download that will work for uploading .mp4's https://github.com/bikecrazyy/sharepoint-library-uploader