I am able to download a file from my SharePoint 2013 server using the following URL and the browser. The URL is ..files('<filename>')/$value
Now, I'm trying to download that document using C# and REST. So far I have something like this:
HttpWebRequest request = null;
HttpWebResponse response = null;
string commandString = string.Format("<SITEURL/FOLDER>/files('{0}')/$value", fileName);
Uri uri = new Uri(siteURL + commandString);
//Set up the HTTP Request
request = (HttpWebRequest)WebRequest.Create(uri);
request.Credentials = CredentialCache.DefaultCredentials;
request.Accept = "application/atom+xml";
request.Method = WebRequestMethods.Http.Get;
response = (HttpWebResponse)request.GetResponse();
Now what?? How do I get the file back? The response stream is empty?! Any code sample in C# would be appreciated!
Thanks