Accessing Sharepoint Documents from Winforms via HTTPS

 I was recently asked how someone could access a document in a Sharepoint list from a Winforms client. His only caveat was that it was secured via SSL.

This is the code I gave him, and it seems to work!

System.Net.WebClient Client = new System.Net.WebClient();

Client.UseDefaultCredentials = false ;

System.Net.ICredentials creds;

creds = new System.Net.NetworkCredential(@"MyUserID", "MyPassword");

Client.Credentials = creds;

Client.DownloadFile("", @"C:\DocumentIWant.doc");

Disclaimer: The software, source code and guidance on this website is provided "AS IS"
with no warranties of any kind. The entire risk arising out of the use or
performance of the software and source code is with you.

Any views expressed in this blog are those of the individual and may not necessarily reflect the views of any organization the individual may be affiliated with.