问题
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