The Community is undergoing an upgrade and some features may be unavailable. Find out more here.
Forum Discussion
TS L.
5 years agoExplorer | Level 4
TaskListFolderAndAccountId does not list all files in the folder
My app is using TaskListFolderAndAccountId to get the list of files and folders from the root directory. It was working fine and list all the files and folders in the root directory without any problem. But recently, without making any changes of codes in the app, it does not list all files and folders, only some are listed.
The dependency use in the app is 'com.dropbox.core:dropbox-core-sdk:3.1.1'
Kindly advise what has gone wroing/
Thank you.
Thanks! We'll look into it and follow up with you there.
- Greg-DBDropbox Staff
The name 'TaskListFolderAndAccountId' does not seem to be part of the Dropbox API or Dropbox Java SDK itself. Is that a method name from your own code?
In any case, can you share the code you're using to call the API to list the files and folders you're referring to? It sounds like you're probably referring to using listFolder or listFolderBuilder though. Do you also have listFolderContinue implemented? Note that per the listFolder/listFolderBuilder documentation, you need to check ListFolderResult.getHasMore to see if there are more results to retrieve, and then use listFolderContinue to do so, if so. You're not guaranteed to get everything back in just one call, and the number of calls that are needed can change over time, so make sure you have that implemented.
- TS L.Explorer | Level 4
Yes, the TaskListFolderAndAccountId is a method name from my own code, sorry for overlooking that. You are also right that I was using listfolder to retrieve the folder and file names and I did not implement listFolderContinue.
I modify my code to include listFolderContinue, more folders and file names are retrieved, but there are still some not retrieved.
Below is my modified codes:
@Override
protected ListFolderResult doInBackground(String... params) {
ListFolderResult kListFolderResult;try {
kListFolderResult = mDbxClient.files().listFolder(params[0]);
while (kListFolderResult.getHasMore() ){
kListFolderResult = mDbxClient.files().listFolderContinue(kListFolderResult.getCursor());
}
return kListFolderResult;
} catch (DbxException e) {
mException = e;
}
return null;
}Kindly advise, what have I missed in order to retriveve the complete list.
Thank you.
- Greg-DBDropbox Staff
Can you elaborate on what exactly is missing?
For example, if you're looking for nested entries, you need to set the recursive mode using ListFolderBuilder.withRecursive.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,874 PostsLatest Activity: 8 hours agoIf 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!