One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
Stevenj519
4 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");
- kylea
Dropbox Staff
- Stevenj519Explorer | 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-DB
Dropbox Staff
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.5,941 PostsLatest Activity: 8 hours ago
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 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!