cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you new to Dropbox? Our Newcomers group is the perfect place to learn the basics, find out more here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I can add an existing member to a shared folder but folder is not available for that member

I can add an existing member to a shared folder but folder is not available for that member

JoelPelaezDot
New member | Level 2

I created a folder (inside of a Team folder), shared it, and added a member (group) and getting null as a response which according to the documentation means success!. But when I log in to dropbox with a member account which belongs to that group I cannot get the folder displayed. To add memeber I'm using this api https://api.dropboxapi.com/2/sharing/add_folder_member with Developer access token and with team access token, both returns null but not working as explained before. any help or any next step after added an existing member would be really usefull.

 

thanks

7 Replies 7

Greg-DB
Dropbox Staff

Adding a member/group to a shared folder via /2/sharing/add_folder_member gives them access to the shared folder, but it does not automatically start showing the folder in their file/folder listing. The shared folder would need to be "mounted" in the account first. The recipient can do so manually as covered here, or an API app can do so for the recipient by calling /2/sharing/mount_folder

JoelPelaezDot
New member | Level 2

That is exactly what I am doing. 1. Sharing a folder, 2. Adding a member to a share folder.,and 3. Mounting the share folder, but here I'm getting an error saying that is already mounted. So what I do is from the dropbox UI go to Shared option (left menu) and once I add the selected folder it gets displayed under my workspace but just the folder and not the full structure (parent folder which contains the shared folder). What I am trying to achieve is something similar to what I can do on dropbox UI, which is I can share any folder inside other shared folder and add members to the lowest folder in the structure, and the member is able to see the full structure. Any help on the steps or maybe some request are not available in the Dropbox API, dropbox SDK for .Net ? Thanks

Greg-DB
Dropbox Staff

If you're getting an error saying that the shared folder is already mounted, that indicates that the folder has already been mounted in that user's account. That could be because the user already did so manually, or by virtue of the user already having it mounted via a parent folder. For example, that could happen if the shared folder is inside a team folder that the user is already a member of. (That case is a bit of a special case, as otherwise nested shared folders, that is, a shared folder inside another shared folder, are not allowed.)

 

I'm not sure I understand your question from your latest comment though. When you add a group or member to a shared folder, they only get access to that shared folder and its contents, not the contents of any parent folders. In the special case mentioned above though, they may happen to also have access to the parent shared/team folder though. When using the API/SDK, you can add members or groups to either level via the same /2/sharing/add_folder_member functionality, by specifying the respective shared folder ID.

 

To make sure I understand what exactly you're looking to implement, could you perhaps share some screenshots showing the flow/structure you want? That may better illustrate the desired scenario.

JoelPelaezDot
New member | Level 2

Thanks for the reply, sorry if I was not clear enaugh.

This is what I have: In the Dropbox UI (business account, I am also the admin). I can create a basic structure of team folders: RootTeamFolder => RawImages => Country =>  State. At this point I can add members and permissions to all folders under RawImages, Country (viewer) and States (editor) successfully and everything is working fine. What I need to do is replicate the same scenario from the .NET SDK or APIs, I can create successfully all folders (based on the icon they are team folders), but when I share Country or State folder I am getting an error that a folder can not be shared if is inside of or contains another shared folder. My question is how is this posible for this scenario to work 100% from Dropbox UI and not from APIS, or there are other APIs not listed in the official doumentation?

Note: I can see many post where they say that the documentation is not 100% right.

Greg-DB
Dropbox Staff

There aren't any other methods that aren't documented that you would need to perform these operations.

 

You can share folders using /2/sharing/share_folder and add members to any particular shared folder using /2/sharing/add_folder_member

 

Note however that having nested shared folders is only allowed inside team folders. Outside of team folders, attempting to make nested shared folders will result in the error you mentioned.

 

It sounds like you're trying to do this outside of a team folder. Try reconfiguring your API calls to do this inside a team folder. You can call /2/sharing/share_folder on any particular folder inside a team folder to share it and get a shared folder ID for it, if it's not already shared, and then call /2/sharing/add_folder_member with the shared folder ID for the particular folder you want to share.

 

Please note though that there are two different configurations that a Business team can use: with a "team space", or without a "team space". Without a team space, team folders are mounted inside each member's account. With a team space, team folders are mounted outside each member's account. If the team you're working with is using a team space, you'll need to explicitly set a header on your API calls to operate inside the team space (where nested shared folders are supported). You can find information on how to do that in the Namespace Guide.

 

JoelPelaezDot
New member | Level 2

1. I am using one requet to get main information like this:

"root_info": {
".tag": "team",
"root_namespace_id": "7448463488",
"home_namespace_id": "7447123984",
"home_path": "/joe pel"
}

2. Then I'm getting metadata for "root_namespace_id": "7448463488" and the response include this : 

"is_team_folder": true,
"owner_team": {
"id": "dbtid:AADIOpY5DVcPBYhnc5BFOM9ILG2jw2U4nm8",
"name": "TeamApril"
},
"name": "Your team's shared workspace",

3. I am creating a new Team folder inside of this root folder by using Team APIs and sending the right params in the header using root tag or namespace tag, the folder is created successfully but "is_team_folder" is always false, I decided to cotinue creating other folders inside this folder but when calling share_folder I am just getting error like previous posts.

Can you point me to a sample or any existing code ?

 

thanks

 

Greg-DB
Dropbox Staff

That output indicates that the team you're connected to does use the "team space" configuration.

 

The 'is_team_folder' will be returned as true for the team space itself, as you saw, but not for other folders inside the team space. Those other folders still get their own shared folder IDs though.

 

It sounds like you're seeing 'already_shared' errors though? (For reference, it's easier for us to help if you post the code and error you're getting.) In this case, that's likely because folders inside a "team space" in particular will get shared automatically. So, for example, after creating the folder, you can get its metadata to get its shared folder ID, like this, from my own testing:

 

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Select-User: <TEAM_MEMBER_ID>" \
    --header 'Dropbox-API-Path-Root: {".tag": "root", "root": "1990815600"}' \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"/test_414984_2\"}"

# {
#   ".tag": "folder",
#   "name": "test_414984_2",
#   "path_lower": "/test_414984_2",
#   "path_display": "/test_414984_2",
#   "parent_shared_folder_id": "1990815600",
#   "id": "id:AAFTM3U8MQAAAAAAAAADiQ",
#   "shared_folder_id": "7575688240",
#   "sharing_info": {
#     "read_only": false,
#     "parent_shared_folder_id": "1990815600",
#     "shared_folder_id": "7575688240",
#     "traverse_only": false,
#     "no_access": false
#   }
# }

I can then use that shared folder ID (7575688240 in my case) with /2/sharing/add_folder_member to add members to just this new folder.

curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Select-User: <TEAM_MEMBER_ID>" \
    --header 'Dropbox-API-Path-Root: {".tag": "root", "root": "1990815600"}' \
    --header "Content-Type: application/json" \
    --data "{\"shared_folder_id\": \"7575688240\",\"members\": [{\"member\": {\".tag\": \"email\",\"email\": \"user@example.com\"}}]}"
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    JoelPelaezDot New member | Level 2
What do Dropbox user levels mean?