cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TaskListFolderAndAccountId does not list all files in the folder

TaskListFolderAndAccountId does not list all files in the folder

TS L.
Explorer | Level 4
Go to solution

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.

 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Thanks! We'll look into it and follow up with you there.

View solution in original post

10 Replies 10

Greg-DB
Dropbox Staff
Go to solution

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
Go to solution

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-DB
Dropbox Staff
Go to solution

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.
Explorer | Level 4
Go to solution

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-DB
Dropbox Staff
Go to solution

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.

TS L.
Explorer | Level 4
Go to solution

The root direcotry complete folders and files are from my Dropbox root folder. Set A and B are getting from the code Log.i("dbFolderName", "dbFolderName: $dbFolderName") when iterating in
for (i in files.indices) loop.

 

I tested again by removing the line folderNameArray.clear(). It gave the same results of A and B as before.

 

Note: I added the line folderNameArray.clear() is to have a clean set before iterating the result.entries with the for(i in files.indices) loop.

Greg-DB
Dropbox Staff
Go to solution

Thanks for the information. It's unclear from this what the issue is then. Could you open an API ticket so we can take a closer look? Please include the full responses that you're getting, without any processing. That is, show what you're getting back in all of the ListFolderResult objects from all of the calls to listFolder and listFolderContinue without any extra handling so we can see the results and cursors. Thanks!

TS L.
Explorer | Level 4
Go to solution

API tiket openned.

 

Ticket #11426113: API: listFolder not retrieving all folders and files at root directory.

 

 

Greg-DB
Dropbox Staff
Go to solution

Thanks! We'll look into it and follow up with you there.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    TS L. Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?