2013-05-03 65 views
1

如標題中所寫,我想使用VB.NET下載Dropbox的公共文件。 很明顯,我無法使用WebClient來完成它,所以我搜索了一些Dropbox API。問題是我並不瞭解所有這些圖書館(也是因爲第三方)。使用VB.NET從Dropbox下載公共文件

有很多東西,比如登錄,上傳,文件管理等等,而我只希望能夠從給定的URL下載Dropbox文件。

我該怎麼辦?

+0

告訴我們你試過的東西。另外,爲什麼你不能使用WebClient? – 2013-05-03 22:31:14

回答

1

爲什麼你不能使用WebClient?我在C#中使用這段代碼,它完美地工作。你可以在VB.NET中嘗試類似的代碼。只要確保文件是共享的。

string onlinePath = @"https://dl.dropboxusercontent.com/s.....&dl=1"; // make sure you get the download path in this form 
string [email protected]"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"); 
} 
+0

它似乎工作,看起來像我用了一個錯誤的鏈接。無論如何,這是不尋常的,我從來沒有使用過WebClient雲服務文件。 – user1714647 2013-05-03 23:11:59