How to download files from OneDrive

c#, onedrive, windows-phone-8

Solution

If you replace the word `redir` with `download` in the url you get the raw file instead of the webpage i.e.

https://onedrive.live.com/download?resid=DBBC281099F4FE69%21646

Problem

I am looking to download my files in public folder from One Drive, but it doesn't download the files. Here is the scenario: In public folder I have another folder with multiple files in it and is accessible widely. for test purpose I have shared all the files in public folder (I don't if it's proper way of sharing it). The following links are provided for me to download the file: - From shared folder link https://onedrive.live.com/redir?resid=DBBC281099F4FE69!646&authkey=!AGRCGuw8Y2_p9mA&ithint=folder%2c.mp3 - From public folder link https://onedrive.live.com/redir?resid=DBBC281099F4FE69%21646 - Direct link http://1drv.ms/1z9XlW6 - I am using `BackgroundTransferRequest` to download the file using below code: ``` string filePathToDownload = string.Empty, fileName = "111.mp3"; filePathToDownload = "http://1drv.ms/1z9XlW6"; Uri transferUri = new Uri(Uri.EscapeUriString(filePathToDownload), UriKind.RelativeOrAbsolute); BackgroundTransferRequest transferRequest = new BackgroundTransferRequest(transferUri); transferRequest.Method = "GET"; transferRequest.TransferPreferences = TransferPreferences.AllowCellularAndBattery; Uri downloadUri = new Uri(DataSource.TEMPDOWNLOADLOCATION + fileName, UriKind.RelativeOrAbsolute); transferRequest.DownloadLocation = downloadUri; transferRequest.Tag = fileName; ``` The file is 300Kb, but this only downloads 6 Kb. How can I directly download the file from the links above (any of them)? thanks!

Original source