You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
sanjayssk
8 years agoHelpful | Level 6
Need .Net sample for download to file
I'm using Dropbox API in an asp.net application. I have managed to download the file contents into a stream upto the following line of code in an async task.
var strm = response.GetContentAsStr...
- 8 years ago
The GetContentAsStream method yields a Stream, so you should be able to use CopyTo like this:
var strm = await response.GetContentAsStreamAsync(); using (var fileStream = File.Create(localFilePath)) { strm.CopyTo(fileStream); }
sanjayssk
Helpful | Level 6
Any ideas how to catch a Timeout exception for large downloads? I tried using Try/Catch but it is not raised.
Update: I tried this code but it doesn't cause a timeout.
var expirationTimeTask = Task.Delay(TimeSpan.FromSeconds(30)); var strm = response.GetContentAsStreamAsync(); var finishedTask = await Task.WhenAny(expirationTimeTask, strm); if (finishedTask == expirationTimeTask) { //timeout error processing (does not get here) }
sanjayssk
8 years agoHelpful | Level 6
Oops. On debugging, I found that it is stuck at CopyTo and that takes a long time and times out. So does the actual download occur on "CopyTo"?
Update: Was above to solve this by studying the Asp.net samples on:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 4 days agoIf 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 or Facebook.
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!