Download public file from Dropbox using VB.NET

喜夏-厌秋 提交于 2019-12-13 17:13:52

问题


as written in the title, I'd like to download a public file of Dropbox using VB.NET. Obviously I'm not able to do it using WebClient, so I searched some Dropbox API. The problem is that I don't understand as well all those libraries (also because of thirdy parties).

There are a lot of things, like login, upload, file managing, ... while I'd like just the capability to download a file of Dropbox from a given URL.

How can I do it?


回答1:


Why can't you use WebClient? I use this code in C#, and it works perfectly. You can try similar code in VB.NET. Just make sure the file is shared.

string onlinePath = @"https://dl.dropboxusercontent.com/s.....&dl=1"; // make sure you get the download path in this form
string downloadedFile=@"C:\..."; // file to download into
try
{
    using (System.Net.WebClient Client = new System.Net.WebClient())
    {
         Client.DownloadFile(onlinePath, downloadedFile);
    }
}
catch
{
    MessageBox.Show("File not found");
}


来源:https://stackoverflow.com/questions/16368233/download-public-file-from-dropbox-using-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!