JL.
JL.

Reputation: 81262

How to upload a file to a folder using webdav?

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

Upvotes: 2

Views: 10145

Answers (1)

csharptest.net
csharptest.net

Reputation: 64218

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

Upvotes: 3

Related Questions