You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
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 probl...
- 5 years ago
Thanks! We'll look into it and follow up with you there.
Greg-DB
Dropbox 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.
5 years agoExplorer | 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-DB5 years agoDropbox 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.
- TS L.5 years agoExplorer | Level 4
What I wanted is the list of folder names from the root directory.
When I used the code:
ListFolderResult kListFolderResult = mDbxClient.files().listFolder("")
I got a few files (folder + files) in kListFolderResult. (Please set A below)When I used the codes:
ListFolderResult kListFolderResult = mDbxClient.files().listFolder("");
while (kListFolderResult.getHasMore() ){
kListFolderResult = mDbxClient.files().listFolderContinue(kListFolderResult.getCursor());
I got more files but not all in the root directory. (Please set B belw)
To get the folder names for kListFolderResult, my codes are as the following:override fun onDataLoaded(result: ListFolderResult) {
var dbFolderName: String
val files = result.entries
folderNameArray.clear()for (i in files.indices) {
dbFolderName = files[i].name
//Todo: for check
Log.i("dbFolderName", "dbFolderName: $dbFolderName")f (files[i] is FolderMetadata) {
folderNameArray.add(dbFolderName)
}Root direcotry complete folders and files:
FirebaseUI [missing in set B]
Misc [mising in set A]
Camera Uploads [missing in set A]
Screenshots [missing in set A and B]
TSlim [missing in set A]
HawkerHelperApk [missing in set A]
HawkerHelperKeyAPK [missing in set B]
MyFamilyData2Code4Name1.4 [missing in set A]
our music [missing in set A]
MyFamilyData2Code2Name1.3.1 [missing in set A]
FamilyTreeSampleData [missing in set A]
PeopleIcon [missing in set A]
Screenshots [missing in set A and B]
FamilyTree Error [missing in set A]
Family Tree backup [missing in set A]
hhelper [missing in set A]
FamilyTreeAPK [missing in set A]
MyFamilyData1Code4Name1.2 [missing in set A and B]
famtree video [missing in set A]
photoDropbox [missing in set A]
Tree [missing in set A]
ApkPhotoStory [missing in set A]
famtreeAACMWa2kNcibCNAJ6nXPFVO95u4nndLjcLwzs [missing in set A
Asssxx.MyFamily20200927_191839 [missing in set A]
famtreeABCMWa2kNcibCNAJ6nXPFVO95u4nndLjcLwzs [missing in set A]
LTS002.MyFamily20180427_153445 [missing in set B]
LTS003.MyFamily20180429_163755 [missing in set B]
LTS001.MyFamily20180419_202734 [missing in set B]
LTS4xx.MyFamily20180608_181400 [missing in set B]
LTS005.MyFamily20180622_061054 [missing in set B]app-debug.apk [missing in set A] (note: this is a file, the rest shown above are folders)
Set A folders and files:InvestcomAPK
HawkerHelperKeyAPK
MyFamilyKeyAPK
FirebaseUI
HawkerPOS_APK
MyFamilyBackUp
LTS002.MyFamily20180427_153445
LTS003.MyFamily20180429_163755
LTS001.MyFamily20180419_202734
LTS4xx.MyFamily20180608_181400
LTS005.MyFamily20180622_061054
Set B folders and files:Misc
Camera Uploads
Screenshots
TSlim
HawkerHelperApk
MyFamilyData2Code4Name1.4
our music
MyFamilyData2Code2Name1.3.1
FamilyTreeSampleData
PeopleIcon
FamilyTree Error
Family Tree backup
hhelper
FamilyTreeAPK
famtree video
photoDropbox
Tree
ApkPhotoStory
famtreeAACMWa2kNcibCNAJ6nXPFVO95u4nndLjcLwzs
Asssxx.MyFamily20200927_191839
famtreeABCMWa2kNcibCNAJ6nXPFVO95u4nndLjcLwzs
app-debug.apk- Greg-DB5 years agoDropbox Staff
Listing a folder (such as root) can take an arbitrary number of calls, so make sure you're aggregating the results from all of the calls.
It's not entirely clear where/when are you actually collecting these result sets. It seems like some of the relevant code may be missing here, but looking at the code you shared, it looks like you may only be collecting the last page, since you're doing folderNameArray.clear() each time.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 3 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!