cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We're looking to hear about your experience when using Dropbox in a web browser. What parts of Dropbox feels very slow to you and takes a lot of time to get done? What are you trying to do in the Dropbox web browser when you experience slowness? Tell us right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Reply and help

How do I get unique listing of all folders on a Dropbox Business account.

How do I get unique listing of all folders on a Dropbox Business account.

rk90
Explorer | Level 4

I have gone through this thread and it is really helpful, but I have a few doubts which I would like to clear.

I want to get the list of all files and folders on a given Dropbox account and segregate by their type. For example, team folder structure will be saved to a local DB table called team_folders and similarly users' personal folders will be saved to personal_folders. The format of the personal_folders will be "/{username}/{folder_path}".

I understand I can use /2/files/list_folder[/continue] with Dropbox-API-Select-User to get the folder listing, but how am I guaranteed to get each and every folder that resides inside the team folder I am listing? I mean if the user 'Dropbox-API-Select-User' does not have permission to a particular folder inside a team folder, then apparently that folder will not be returned in listing call. Would using 'Dropbox-API-Select-Admin' solve this?

Also, when I list folders I am going to get duplicates. For example, member A and member B have access to a team folder called 'team_folder'. When I use /2/files/list_folder[/continue] with member A, I get the listing of all folders (including recursive listing of 'team_folder'). Then I use /2/files/list_folder[/continue] with member B and I will again get the listing of 'team_folder'. Am I wrong here? Moreover, if member A and member also have access to a shared folder, then I'll list that shared folder twice.

Although, I have read through the doc that explains team space and non-team space, but I am not sure how would that affect my coz I am not checking/considering whether or not the account I am operating on has a team space.

Also, a shared folder can be mounted with different name in members' folders. How would I find the original name of that mounted folder and then generate a list of aliases (i.e. mount points to that folder in members' folder)

I'd appreciate if someone can help me clear my doubts and perhaps explain/suggest an approach.

Apologies for this lengthy post.

 

 

1 Reply 1

Re: How do I get unique listing of all folders on a Dropbox Business account.

Greg-DB
Dropboxer

 


how am I guaranteed to get each and every folder that resides inside the team folder I am listing? I mean if the user 'Dropbox-API-Select-User' does not have permission to a particular folder inside a team folder, then apparently that folder will not be returned in listing call. Would using 'Dropbox-API-Select-Admin' solve this?

Yes, using 'Dropbox-API-Select-User' essentially lets you act as that user, so it would only have access to whatever that user has access to. Using 'Dropbox-API-Select-Admin' instead lets you access any team content. 

Also, when I list folders I am going to get duplicates. For example, member A and member B have access to a team folder called 'team_folder'. When I use /2/files/list_folder[/continue] with member A, I get the listing of all folders (including recursive listing of 'team_folder'). Then I use /2/files/list_folder[/continue] with member B and I will again get the listing of 'team_folder'. Am I wrong here? Moreover, if member A and member also have access to a shared folder, then I'll list that shared folder twice. 


That's correct, if you list everything in multiple members accounts, and multiple members have the same team or shared folder mounted, you'll see the same entries multiple times. You can de-duplicate these by checking the "shared folder ID" or "team folder ID" in the metadata for the shared/team folders. Those IDs will be consistent across accounts.

Although, I have read through the doc that explains team space and non-team space, but I am not sure how would that affect my coz I am not checking/considering whether or not the account I am operating on has a team space.

The primary difference is that for teams not using the team space, the team folders are mounted inside each member's personal folder. For teams using the team space, it's reversed. I.e., the members' personal folders are mounted inside the team space. The latter would make listing everything a little easier, as the team folder(s) won't get duplicated across accounts.

Also, a shared folder can be mounted with different name in members' folders. How would I find the original name of that mounted folder and then generate a list of aliases (i.e. mount points to that folder in members' folder) 

You can get the name of a shared folder from /2/sharing/get_folder_metadata. You can list the mounted shared folders, including the paths (i.e., the mount points) in an account using /2/sharing/list_folders[/continue]. 

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?