Take Your Search Game to the Next Level with Dropbox Dash 🚀✨ Curious how it works? Ask us here!
Forum Discussion
AndresSilva
2 months agoNew member | Level 1
I need to get all folders and nested folders within a team
Hi team!
For an app we are making we need to access all folders and subfolders in a dropbox team. Just the folder names, however when calling.
/2/team/team_folder/list
Im only getting the top level folders, not getting the subfolders.
And when calling
2/sharing/list_folders
Im not getting any cursor as a response, just a list that includes around 5% of all my folders, even setting the limit to 1000 I dont get more than that.
Do you know how to solve this?
Thanks,
Andres
3 Replies
Sort By
- johndayNew member | Level 2
Hi Andres,
To retrieve all folders and nested subfolders within a Dropbox Team, you need to use a recursive approach since /2/team/team_folder/list only provides top-level folders.
Steps to Get All Folders (All Unlocked):
List Team FoldersFirst, call /2/team/team_folder/list to get the top-level folders.
List Contents of Each FolderUse /2/files/list_folder with "recursive": true to get all subfolders.
You need to pass the "team_folder_id" from the previous step to get subfolder details.
Handle Pagination (Cursor Handling)If the response includes a "cursor", use /2/files/list_folder/continue to get more data until everything is retrieved.
For /2/sharing/list_folders, it only shows shared folders and has limitations. It won’t return all team folders. Instead, use /2/files/list_folder with team permissions to list everything (All Unlocked) inside a given path.Let me know if you need more help!
- iNeil
Dropbox Engineer
Hi johnday,
Thanks for providing the additional information on this Dropbox forum.
If you're looking to retrieve a list of all team folders, you can use the /2/team/team_folder/list and /2/team/team_folder/list/continue endpoints. However, these endpoints only include team folders and exclude other types of folders.
For a more comprehensive view of all files and folders accessible to your team, we recommend listing the contents of all team-accessible namespaces instead. You can do this using the /2/team/namespaces/list and /2/team/namespaces/list/continue endpoints. These will provide a list of namespaces, which includes team folders as well as shared folders containing team members, team members' home namespaces, and team members' app folders.
Once you have the namespace_ids, you can then use the /2/files/list_folder and /2/files/list_folder/continue endpoints to retrieve the contents within the namespaces. We have a code sample here of how to implement that strategy to list all of the files and folders that a team can access.
- iNeil
Dropbox Engineer
Hi AndresSilva,
If you would like to access all folders and subfolders within a Dropbox team, please review the following links below:
In relation to the 2/team/team_folder/list endpoint, it will only list the team folders connected to the account, not the files or folders within those team folders. If you need to list your files and folders, you can use the /files/list_folder and /files/list_folder/continue endpoints.
In relation to the 2/sharing/list_folders endpoint, this will return a list of all shared folders accessible to the Dropbox account associated with the access token. If a cursor is not returned, it indicates that all shared folders have been returned.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,998 PostsLatest Activity: 2 hours ago
If 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!