I am using following code to upload file at the following location but getting File Not Found error at last line "clientcontext.ExecuteQuery();"
using (ClientContext clientcontext = new ClientContext(txtSiteURL.Text))
{
string fileToUpload = @"c:\test.txt";
String fileName = System.IO.Path.GetFileName(fileToUpload);
Folder folder = clientcontext.Web.Lists.GetByTitle("Docs").RootFolder;
string documentUrl = txtSiteURL.Text + "/Docs/" + fileName;
FileCreationInformation fci = new FileCreationInformation();
fci.Overwrite = true;
fci.Url = documentUrl;
fci.Content = System.IO.File.ReadAllBytes(fileToUpload );
Microsoft.SharePoint.Client.File uploadedFile = folder.Files.Add(fci);
clientcontext.ExecuteQuery();
}
What am I doing wrong?
/
character in filename