使用VB.NET从Dropbox下载公共文件 [英] Download public file from Dropbox using VB.NET

查看:68
本文介绍了使用VB.NET从Dropbox下载公共文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题中所述,我想使用VB.NET下载Dropbox的公共文件。
很显然,我无法使用WebClient进行此操作,因此我搜索了一些Dropbox API。问题是我对所有这些库也不太了解(也是由于第三方的原因)。

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).

有很多东西,例如登录,上传,文件管理...,而我只是想从给定URL下载Dropbox文件的功能。

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.

我该怎么办?

推荐答案

为什么不能您使用WebClient?
我在C#中使用此代码,它可以完美地工作。您可以在VB.NET中尝试类似的代码。只需确保文件是共享的。

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");
}

这篇关于使用VB.NET从Dropbox下载公共文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆