Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
melium
9 years agoHelpful | Level 6
task async convert to void
does anyone know a different method not using task async i want to use void
public async Task Download(string remoteFilePath, string localFilePath)
{
DropboxClient client2 = new DropboxClient("token");
remoteFilePath = "img2.jpg";
localFilePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
using (var response = await client2.Files.DownloadAsync(remoteFilePath))
{
using (var fileStream = File.Create(localFilePath))
{
response.GetContentAsStreamAsync().Result.CopyTo(fileStream);
}
}
}i got it working
public async void DownloadDB() { try { DropboxClient client2 = new DropboxClient("token"); string file = "/data1.db3"; string folder = @"/data/data/AndroidMaster.AndroidMaster/files/data1.db3"; using (var response = await client2.Files.DownloadAsync(file)) { using (var fileStream = File.Create(folder)) { (await response.GetContentAsStreamAsync()).CopyTo(fileStream); } } } catch (Exception ex) { Console.WriteLine(ex); } }
2 Replies
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
I'm not sure if I follow your question, but if you're looking for alternate versions of the Dropbox .NET methods, they are also available. E.g., for Download:
https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_BeginDownload_1.htm
https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_EndDownload.htm - melium9 years agoHelpful | Level 6
i got it working
public async void DownloadDB() { try { DropboxClient client2 = new DropboxClient("token"); string file = "/data1.db3"; string folder = @"/data/data/AndroidMaster.AndroidMaster/files/data1.db3"; using (var response = await client2.Files.DownloadAsync(file)) { using (var fileStream = File.Create(folder)) { (await response.GetContentAsStreamAsync()).CopyTo(fileStream); } } } catch (Exception ex) { Console.WriteLine(ex); } }
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!