You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

searchx's avatar
searchx
Explorer | Level 4
7 years ago

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 has access to with in the business account. 

 

After reading through the documentations, looks like I need to following steps. 

 

Is there any other simple way which will give me all the data that user has and also has access to?

 

For all of the below, I will be using 'Dropbox-API-Select-Admin' as one of the headers so that it has access to any user account with in the business account.

 

For business accounts, here is the flow for getting the data 
from dropbox

1. namespaces (team/namespaces/list)
2. members (team/members/list)

To get the full data of a particular user,

1. Find the 'member_folder_id' of the user from
'members' api
2. Use that value as namespace id 'ns:member_folder_id' in the
header path.
3. From the 'namespaces' find all the 'shared_folder' where
this particular user is a member by calling
['sharing/list_folder_members'
and by group APIs where user
can be a member]
 
  • 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.
  • Lusil's avatar
    Lusil
    Icon for Dropbox Staff rankDropbox Staff
     
    Initially, I wanted to suggest that, if you’re a team admin, you could create an activity report or export a member data report. You might also find this thread to be helpful as well.
     
    Finally, you’ll notice that I’ve moved your post here since you may find more relevant info/suggestions to your query. :grinning:
     
    In the mean time, I hope you have wonderful day ahead!
    • searchx's avatar
      searchx
      Explorer | Level 4

      Thanks for reply.

       

      Looks like that doesn't work for me. My app has 'Team member file access'. When I try the below,

       

      POST /2/files/list_folder
      Host: https://api.dropboxapi.com
      Authorization: Bearer <token>
      Content-Type: application/json
      Dropbox-Api-Select-User: dbmid:

      {
      "path": "",
      "recursive": true
      }

       

      I get only the list of files from the user and nothing from team folders.