Search code examples
javadropboxdropbox-apidropbox-sdk

Dropbox API ListFolder limit 2000 entries


I found this out recently that the listFolder/Continue API returns 2000 entries only. And I have also tried recursion and while loops to fetch all the metadata and add to a existing top level result.getEntries() list. But none of these approaches are working, I still see that only 2000 metadata entries are in the ultimate result.

Has anyone tried and made it work in Java?


Solution

  • Each page of listFolder results, i.e., each response from a single call to listFolder or listFolderContinue, can contain up to about 2,000 entries. (Note that this number is not guaranteed, so you should not rely on it.)

    To make sure you can get all of the items in a folder, you need to use both listFolder and listFolderContinue, calling back to listFolderContinue with the latest cursor when the hasMore on the last call was true. There's a working example here:

    https://github.com/dropbox/dropbox-sdk-java/blob/c6aeb4bf3011e6b803eaa325ea20a52f8412ee0f/examples/tutorial/src/main/java/com/dropbox/core/examples/tutorial/Main.java#L32