Discuss Dropbox Developer & API
I creating app for uploading files into Dropbox. Right now I stuck working with files / folders inside Dropbox. By this tutorial I create this method for getting data about folders and create new folder inside Dropbox https://github.com/dropbox/dropbox-sdk-java, but it does not works. I can get data about my account, but when I try to get data about folders it stucks. I also already try to allow all file permissions in dropbox app settings.
private void createFolder() throws DbxException {
log.info("start createFolder");
FullAccount userData = clientV2.users().getCurrentAccount();
log.info("userData {}", userData.getName());
// Get files and folder metadata from Dropbox root directory
ListFolderResult result = clientV2.files().listFolder("");
while (true) {
for (Metadata metadata : result.getEntries()) {
log.info(metadata.getPathLower());
}
if (!result.getHasMore()) {
break;
}
result = clientV2.files().listFolderContinue(result.getCursor());
}
}
Response:
2024-05-02T17:05:32.800+02:00 INFO 33560 --- [mail] [Mail-EventQueue] com.example.mail.component.Monitor : start createFolder
2024-05-02T17:05:33.915+02:00 INFO 33560 --- [mail] [Mail-EventQueue] com.example.mail.component.Monitor : userData {"given_name":"Miloslav","surname":"Lejček","familiar_name":"Miloslav","display_name":"Miloslav Lejček","abbreviated_name":"ML"}
[Cross-linking for reference: https://stackoverflow.com/questions/78419300/get-dropbox-folders-data ]
Based on your answer on StackOverflow, it sounds like you've already sorted this out. To confirm, scope changes on an app do not retroactively apply to existing access tokens.
Calling listFolder does require the "files.metadata.read" scope. If you attempt a call like that using an access token without the relevant scope granted though, you should get an exception raised, so you may want to check on how you're handling exceptions in your app to make sure you can see exceptions like that.
Hi there!
If you need more help you can view your support options (expected response time for a 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!