Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
GopalN
6 years agoExplorer | Level 4
Not able to get team folders or files using python sdk
Python SDK, Not Able to get files and folders where I'm using dropbox business API access token
output = dbx.DropboxTeam(_dropbox_token).as_admin(ng_member_id).files_list_folder("").entries ...
- 6 years ago
What is the value of your '_team_name_space_id' variable?
Based on the error output you shared, if you want to list the contents of the team space, you should set your '_team_name_space_id' variable to "5632093280".
phermans
5 years agoExplorer | Level 3
Greg-DB , I got that part working, but don't totally understand one part, hoping I missed it in the docs somewhere, or that there is a simple explanation. In the code you posted, there was both a for loop and a while loop...
for entry in listing.entries:
print(entry.name)
while listing.has_more:
listing = dbx_admin_team_root.files_list_folder_continue(listing.cursor)
for entry in listing.entries:
print(entry.name)Not sure I understand why i need both of those. Seems like the initial for loop only gets some of the folders/files.....then the while keeps asking for more....but if that is correct, why even bother with the first for loop, why not just use the while listing.has_more loop? Wouldn't that just keep going until all the files/folders were returned, and in this case, had their names printed?
Thanks for clarifying.
Greg-DB
Dropbox Community Moderator
5 years agophermans In order to scale to folder listings of any size, the list_folder interface is paginated. The API may return the results across multiple pages, and each page can contain multiple files/folders. You need to implement calls to both files_list_folder and files_list_folder_continue to make sure you can receive all of the entries.
The first for loop iterates over the results on the first page, from files_list_folder; the while loop then has the app make additional calls to files_list_folder_continue as needed, and the second for loop iterates over the results from those subsequent pages, if any, from files_list_folder_continue.
Check out the files_list_folder documentation for more information on using this functionality.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!