Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
searchx
8 years agoExplorer | Level 4
How to get all the files and folders of a business account ?
I am trying to find the possible ways to get all the 1) Personal files and folder 2) team folder and files 3) Anything shared with the user. Basically a complete snapshot of what the particular user ...
- 8 years ago
It sounds like for what you're trying to do, the basic outline would look like this:
- Call /2/team/members/list[/continue] or /2/team/members/get_info to get the team member's information, such as their member ID, if you don't already have it.
- Call /2/users/get_current_account with Dropbox-API-Select-User containing the member ID to get the member's root info, i.e., both their root namespace ID and their home namespace ID. (This will be a "TeamRootInfo" type if the user is part of a team using the team space configuration.)
- Call /2/files/list_folder[/continue] with path="" and recursive=true to get the full file/folder listing for the member using both Dropbox-API-Select-User containing the member ID and Dropbox-API-Path-Root containing the "home" mode as documented in the Namespace Guide (or just omit it, since this is the default). Note that this will include anything mounted inside the member's Dropbox, e.g., shared folders. Be sure to continue paging through using /2/files/list_folder/continue when has_more=true as documented for /2/files/list_folder.
- Repeat the above, but using Dropbox-API-Path-Root with the "root" mode and supply the "root_namespace_id". This will give the contents of the team space.
Greg-DB
Dropbox Community Moderator
8 years agosearchx It sounds like the team probably uses the "team space" configuration, so the team folders aren't mounted inside the member's own folder. You'll need to use the "Dropbox-API-Path-Root" header to identify the team space in that case. The Namespace Guide goes over this in detail:
https://www.dropbox.com/developers/reference/namespace-guide
searchx
8 years agoExplorer | Level 4
Thanks Greg.
It is still confusing. Let me re-iterate my problem.
I have an Admin token and I would like to see all the files that user has access to ( Private, team and shared). Accoding to the team space concept, in order to do that, I need to first find out all the name space ids and make calls (list/list_folder) for each?
Or is there a way, that I can make single (list_folder/continue) call as described in the documentation 'Dropbox-API-Select-User' ?
If there is a way, what combination of headers( Dropbox-API-Select-User andDropbox-API-Path-Root) I should use?
- Greg-DB8 years ago
Dropbox Community Moderator
It sounds like for what you're trying to do, the basic outline would look like this:
- Call /2/team/members/list[/continue] or /2/team/members/get_info to get the team member's information, such as their member ID, if you don't already have it.
- Call /2/users/get_current_account with Dropbox-API-Select-User containing the member ID to get the member's root info, i.e., both their root namespace ID and their home namespace ID. (This will be a "TeamRootInfo" type if the user is part of a team using the team space configuration.)
- Call /2/files/list_folder[/continue] with path="" and recursive=true to get the full file/folder listing for the member using both Dropbox-API-Select-User containing the member ID and Dropbox-API-Path-Root containing the "home" mode as documented in the Namespace Guide (or just omit it, since this is the default). Note that this will include anything mounted inside the member's Dropbox, e.g., shared folders. Be sure to continue paging through using /2/files/list_folder/continue when has_more=true as documented for /2/files/list_folder.
- Repeat the above, but using Dropbox-API-Path-Root with the "root" mode and supply the "root_namespace_id". This will give the contents of the team space.
- searchx8 years agoExplorer | Level 4
Thank you!
This works perfect! From my testing, I notice is that, the last item itself gives me everything. Step3 looks redundant.
Only difference between both the methods is how path_lower returned for 'Private' and 'Shared' items and which makes sense based on what set as root.
If anyone else looking for the same, final snippet of what I used for finding all the 'Private', 'Shared' and 'Team' content of what each user has access to with in the business account.
path = {".tag": "root","root":"namespace_id of team_folder"}
headers = {
"Authorization": "Bearer " + self.access_token,
"Content-Type": "application/json",
"Dropbox-API-Path-Root": json.dumps(path),
"Dropbox-API-Select-User": "dbmid:....."
}
data = {
"path": "",
"recursive": True
}
About Dropbox API Support & Feedback
Find help with the Dropbox API from 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!