I am getting the File Not Found exception in the ExecuteQuery() method but the file is sitting there in the mentioned folder.
I have included my code below. I am working on a .NET core application.
FileCreationInformation newFile = new FileCreationInformation();
newFile.Url = System.IO.Path.GetFileName(filePath);
newFile.Content = System.IO.File.ReadAllBytes(filePath);
Folder library = SPClientContext.Web.Folders.GetByUrl(fullFolderUrl);
Microsoft.SharePoint.Client.File uploadFile = library.Files.Add(newFile);
SPClientContext.Load(uploadFile);
SPClientContext.ExecuteQuery();
Microsoft.SharePoint.Client.ServerException
HResult=0x80131500
Message=File Not Found.
Source=Microsoft.SharePoint.Client.Runtime
StackTrace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at SharePointTest.Program.<Main>d__0.MoveNext() in C:\Users\O