Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Alexey S.7
11 years agoNew member | Level 1
Help realise download file from Dropbox folder on Visual Basic 2015
I need help in realise downloading file from Dropbox folder on Visual Basic 2015. I found example code only on ASP.NET, but I can`t translate it to Visual Basic code.
async Task Download(DropboxClient dbx, string folder, string file) { using (var response = await dbx.Files.DownloadAsync(folder + "/" + file)) { Console.WriteLine(await response.GetContentAsStringAsync()); } }
I have Dropbox account and local dropbox client.
I need read (only) file from my folder.
How can I get path to file ? How to save local copy if I need.
Best regards, Alex.
6 Replies
- Greg-DB11 years ago
Dropbox Community Moderator
The DownloadAsync method can be used to download files, as you mentioned, but to find the paths of files, you can use ListFolderAsync. That will give you a ListFolderResult, which contains entries with paths.
What have you tried so far, and what are you stuck on? Can you share any code and output that's giving you trouble?
- Alexey S.711 years agoNew member | Level 1
Unfortunately, I have not yet ready code, even not working code. I ask step by step example on Visual Basic. Purpose: read file(mytxtfile.txt) from person dropbox folder. That`s all.
1. Definition of variables of Dropbox.Api Dropbox.Api. Which one minimum instances of variables do I need for my purpose ?
Dim dbx as Dropbox.Api.DropboxClient
What else ?
2. Which method do I need to use to get local copy of file from dropbox folder ?
Dim dbxFolder As dbx.Files.ListFolderResult
How to use dbxFolder to get exact file(mytxtfile.txt) ?
In general I need simple sample of code on Visual Basic how to get file. Thats all.
Thanks in advance.
- Greg-DB11 years ago
Dropbox Community Moderator
In that case, I recommend starting with the tutorial, which covers the basics, here:
https://www.dropbox.com/developers/documentation/dotnet#tutorial
- Gene H.710 years agoNew member | Level 1
Since more than 6 months iam trying to figure it out, but it looks impossible to me, Finally iam here now
I wanna ask, i have uploaded a text file to dropbox, and i can see its content in my forms in VB.Net here is the code i used
Dim myWebClient As New System.Net.WebClient
Dim file As New System.IO.StreamReader(myWebClient.OpenRead("https://www.dropbox.com/s/yfarlrua18vbajo/PRUEBA.txt?dl=1"))
RichTextBox1.Text = file.ReadToEnd()
file.Close()Now my Question is how can i edit this text or add more text into my text file from my VB application ? Is there any other way to edit this text from Visual basic only without using dropbox API ?
- Greg-DB10 years ago
Dropbox Community Moderator
Faris, if you just have the shared link to the file, you can't edit the file.
If you have any further questions, please open your own thread instead of replying on this unrelated thread, so that we don't spam anyone else on it.
- knight260110 years agoExplorer | Level 3
Public Async Function Download(destination As String, file As String) As Task(Of Boolean) Try If client Is Nothing Then Await GetAccessToken() ' <- if your client is not defined then define a new client here Using response = Await client.Files.DownloadAsync("/" + file.Replace("\", "/")).ConfigureAwait(False) ' paths use / seperators, Dim result = Await response.GetContentAsByteArrayAsync().ConfigureAwait(False) ' wait for download completion System.IO.File.WriteAllBytes(destination, result) ' write to file system End Using Return True Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error downloading") Return False End Try
end function
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!