I'm trying to download a simple file from a Dropbox for a rather large C# program I am developing.
My file path for the file in the dropbox is:
"C://Users//xxxx//Dropbox (MAD treat)//C#//Sweetners.docx"
I've also tried to get this to work by placing the file just in the dropbox:
"C://Users//xxxx//Dropbox (MAD treat)//Sweetners.docx"
Here's the coding I am using:
public async Task<bool> Download() {
DBClient = new DropboxClient("zy4WfD_K0CME67Ng6123123123123123123123vCs5ye3LR4FQ5WbbQc7SETCETCETCNotTheRealAuthentication");
try {
var localFilePath = @C:/C# Production;
string folder = "/C#";
string file = "Sweetners.doc";
using(var response = await DBClient.Files.DownloadAsync(folder + "/" + file)) {
using(var fileStream = File.Create(localFilePath)) {
(await response.GetContentAsStreamAsync()).CopyTo(fileStream);
}
}
return true;
}
catch(Exception ex) {
MessageBox.Show(ex.ToString());
return false;
}
}
============================
When I step through this, I get a "path not found" error at "await DBClient.Files.DownloadAsync(folder + "/" + file)" request.
I have tried various combinations of folder and file, including. . .
folder = "/Dropbox (MAD treat)/C#" and "/C#", "//Dropbox (MAD treat)//C#" and "//C#"
and file = "Sweetner.docx" and "Sweetner.doc", as well as "/Sweetner.docx" and "/Sweetner.doc"
I've also tried just using "/Dropbox (MAD treat)/C#/Sweetners.docx", "//Dropbox (MAD treat)//C#//Sweetners.docx", and "//Dropbox
All to no avail! I keep getting the "file path not found" error.
Is this because DBClient.Files.DownloadAsync doesn't recognize spaces in the "Dropbox (Mad treat)" folder. . . spaces that I can't remove??
Thanks in advance!!