如何从OneDrive下载文件 [英] How to download files from OneDrive
问题描述
我正在从One Drive下载公用文件夹中的文件,但没有下载文件. 这是场景:
在公用文件夹中,我还有另一个包含多个文件的文件夹,并且可以广泛访问. 出于测试目的,我已经共享了公用文件夹中的所有文件(如果这是共享文件的正确方法,则不是).
提供了以下链接供我下载文件:
- 从共享文件夹链接> ://onedrive.live.com/redir?resid = DBBC281099F4FE69!646& authkey =!AGRCGuw8Y2_p9mA& ithint = folder%2c.mp3
- 从公用文件夹链接 https://onedrive.live.com/redir?resid= DBBC281099F4FE69%21646
- 直接链接 http://1drv.ms/1z9XlW6 -
我正在使用BackgroundTransferRequest
通过以下代码下载文件:
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;
文件为300Kb,但这仅下载6 Kb.
如何直接从上面的链接(其中的任何一个)下载文件?
谢谢!
如果在网址中将redir
替换为download
,则会得到原始文件,而不是网页.
> https://onedrive.live.com/download?resid=DBBC281099F4FE69%21646 >
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!
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
这篇关于如何从OneDrive下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!