Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Robert S.138
9 years agoHelpful | Level 7
Creating a folder in Dropbox
Is there a sample of creating a folder in Dropbox from the Android Java SDK for Core API v2? The example of uploading files seems to deal only with the root folder. I have a background task that ha...
Greg-DB
Dropbox Community Moderator
9 years agoYes, API v2 offers structured exceptions, so you can detect specific scenarios like this. The documentation for createFolder covers all of the types of exceptions it can throw.
For example, to detect this particular error case:
try {
FolderMetadata folder = client.files().createFolder("/test_java_createFolder");
System.out.println(folder.getName());
} catch (CreateFolderErrorException err) {
if (err.errorValue.isPath() && err.errorValue.getPathValue().isConflict()) {
System.out.println("Something already exists at the path.");
} else {
System.out.print("Some other CreateFolderErrorException occurred...");
System.out.print(err.toString());
}
} catch (Exception err) {
System.out.print("Some other Exception occurred...");
System.out.print(err.toString());
}
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!