Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Stevenj519
5 years agoExplorer | Level 3
Moving Local Website and Local SQL to Azure
Hello,
I am in the process of porting my SQL DB and Website to Azure. Basically, I did it; and it works, EXCEPT, the Dropbox part of it does not work 😞 .
Below is my C# code that works when the website is running on a local machine, it works because the Dropbox app is installed on that Server. In the below code, Dropbox syncs folders are on the D:\ drive. It's simple code... if a subfolder doesn't exist, then the code creates a subfolder in Dropbox; then it copies a file to that subfolder.
I installed the Dropbox.Api in my Visual Studio web app, but before I start messing things up, I thought I'd ask you smart folks if you can take the below code and tell me what to change it to so it works on Azure App Services.
Thank you very much!
string path = formatYYYY + @"\" + formatMM + @"\" + formatDD + @"\";
long s1 = 0;
try
{
if (Directory.Exists(@"D:\Dropbox\Jobisez LLC\Archive\Translation\" + path))
{
}
else
{
DirectoryInfo di = Directory.CreateDirectory(@"D:\Dropbox\Jobisez LLC\Archive\Translation\" + path);
}
}
catch
{
DirectoryInfo di = Directory.CreateDirectory(@"D:\Dropbox\Jobisez LLC\Archive\Translation\" + path);
}
File.Copy(sFileDir + Session.Contents["Id"].ToString() + "." + sFileName + "." + myActivityDtTm + ".TXT", @"D:\Dropbox\Jobisez LLC\Archive\Translation\" + path + Session.Contents["Id"].ToString() + "." + sFileName + "." + myActivityDtTm + ".TXT");
3 Replies
- kylea5 years ago
Dropbox Staff
When using the API, you'll need to use the Dropbox methods for browsing the filesystem, getting a path, and downloading it. (The API doesn't mount Dropbox to the local filesystem). See here for the Dropbox .NET SDK overview and here for examples.
- Stevenj5195 years agoExplorer | Level 3
Hi, and thank you! But those example are 1000s of lines each. I'm just trying to find the C# code to create a subfolder within Dropbox (if necessary); and upload a file to that Dropbox subfolder. Does anyone have the "important" code to do that? Like the "using" statements, etc.
Thanks again,
Steve.
- Greg-DB5 years ago
Dropbox Community Moderator
Specifically, to create a folder in the connected Dropbox account using the .NET SDK, you'd want to use the CreateFolderV2Async method. And to upload files, you can use the UploadAsync method. Those are links to the documentation for each method for more information on the options offered by each. You can also find the relevant parts of the examples here and here.
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!