spring-bootdropbox

Get Dropbox folders data


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());
    ListFolderResult folderList = clientV2.files().listFolder("");
    log.info("fullFolderList data {}", folderList);
    while (true){
        for(Metadata metadata: folderList.getEntries()){
            log.info("folderData: {}", metadata.getPathLower());
        }
        if(!folderList.getHasMore()) {
            break;
        }
        folderList = clientV2.files().listFolderContinue(folderList.getCursor());
    }
    CreateFolderResult resp = clientV2.files().createFolderV2("/testovaciSlozka");
    log.info("createFolder: {}", resp);
}

2024-05-02T14:45:50.064+02:00 INFO 23828 --- [mail] [Mail-EventQueue] com.example.mail.component.Monitor : start createFolder 2024-05-02T14:45:50.713+02:00 INFO 23828 --- [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"}


Solution

  • I just needed to generate a new access token after changing the permissions settings