Download a Document From Sharepoint 2010 via WebClient

Here’s how I use the WebClient object to download a pdf from Sharepoint 2010:

1
2
3
4
5
6
string uri = "wwww.google.ca";
string filepath = "waffles.pdf";

WebClient wc = new WebClient();
wc.Credentials = loginCredentials;
byte[] generatedPdf = wc.DownloadData(uri + "/" + filePath);