How to upload a file to a folder using webdav?
-
06-07-2019 - |
Question
I have this webdav code thats creating folders in SharePoint:
HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);
request.Credentials = wsLists.Credentials; // CredentialCache.DefaultCredentials;
request.Method = "MKCOL";
response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();
How can I change the code now to upload a file now to this newly created folder. I think this is a generic webdav question, thanks
Solution
You should be able to do this with WebClient.UploadFile
see also this question for using HttpRequest: webclient-upload-file-error
or google search for WebClient.UploadFile webdav
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow