cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Helpful | Level 5

I have an App built on the Dropbox API (https://songdocs.io).

 

I want to send a link to a folder to a friend, and I know I can get a shared link (which gives anyone with it view permissions) and send that to them.

 

I would like to give them editable accessto the folder but a) I don't know how I would figure out their dropbox user id. Is there a way to get that? (assuming I've never shared anything with them before fwiw). I don't see anything about Contacts in the API.

 

Maybe there's another way to accomplish this though too? Totally open to suggestions here. But if user #2 has the shared view link and they gain access to it in my app is there a way for user #2 to request access to mount the folder with edit permissions somehow from my app and for me to communicate that to user #1?

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

The 'sharing_info' is only set on a folder if the folder is itself shared as a shared folder (or is inside a shared folder). Note that this is different than the kind of sharing offered by /2/sharing/create_shared_link_with_settings. Calling /2/sharing/create_shared_link_with_settings for a folder will not make it a "shared folder"; it only creates a "shared link" for it.

 

To first share the folder as a shared folder, so that it will receive 'sharing_info' with a 'shared_folder_id' that you can then use with /2/sharing/add_folder_member, you should first call /2/sharing/share_folder

View solution in original post

25 Replies 25

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

If you don't already have a connection to the other user in Dropbox, there isn't a way to retrieve it. Instead, you can share it with them via their email address.

 

To give them access to mount and edit the folder, you would first share the folder, then add them to the folder. In that second step, you can specify the recipient either by Dropbox ID or email address.

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Helpful | Level 5

What if I do already have a connection to the other user in dropbox (we've previously shared some things)? How would I go about getting their dropbox id? Is there a way (short of just walking through every file and every share bit on it) that I can access my contacts in dropbox?

 

Also what if I send it to user #2's email but it's not precisely the dropbox account email that user #2 uses? 

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

The Dropbox API doesn't offer a way to list all known contacts, so you'd need to find the account by listing the members of the relevant existing shared folder(s).

 

The recipient can still accept the invitation if they happen to use a different email address on their Dropbox account.

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Helpful | Level 5

My application wouldn't know existing folders my user has shared with their friends, but could walk their dropbox and amass a contacts list (yucky though).

 

Looking at SharingAddFolderMemberError it does appear that if I tried to share with an incorrect email it might not work though.. if I shared a SharedLink would there be any way for the receiving user to request access to mount it / gain edit privileges using the API? 

 

I think it's more intuitive that I should send my friend a shared link and then either they do or don't have a dropbox account and then could gain edit access if they did (it would match my goals and I think help incentivize a user to login with their Dropbox account to be able to contribute vs just view/participate/lurk).

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

By "it does appear that if I tried to share with an incorrect email it might not work", are you referring to the 'email_unverified' or 'invalid_email' errors, perhaps? Those actually just refer to the connected user's account (i.e., for the access token you're using) not being verified, or the email address value for the recipient not being in the expected email address format, respectively. Those are not referring to the state, or lack thereof, of the recipient's Dropbox account.

 

Anyway, there isn't a way for a recipient of a shared link for a folder to both view and optionally then directly get access to mount and edit the folder in their Dropbox account using just the one shared link unfortunately. These are different types of Dropbox sharing that don't directly connect to each other.

 

You can accomplish this using multiple links though. You can create shared links to send to the other users so they can view/download the content, and also get the "preview_url" of the shared folder which other users can use to request access to the shared folder for mounting and editing.

 

 

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Helpful | Level 5

Ah, that last part sounds exactly like what I want to explore, thanks Greg!

 

So I've created a shareLink for my folder and requested the `short_url`.

 

`folder.url` is https://www.dropbox.com/sh/is3b7lj3go9g9ul/AACKo9xo_qf0rn0kh4TIZSgza?dl=0

`short_url` is https://db.tt/eMUUFEZY8d

 

When I try to use that `short_url` in a call to `get_shared_link_metadata` I get `error{.tag: "shared_link_not_found"}` but when I use the resolved URL (aka `folder.url`) it works. Is that to be expected?

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

Yes, that endpoint expects the full shared link, not the short version.

 

By the way, it sounds like you're using the /2/sharing/create_shared_link endpoint to get that short URL. That endpoint is deprecated, so you should use the /2/sharing/create_shared_link_with_settings replacement instead. That doesn't offer the ability to get short URLs though.

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Helpful | Level 5

Hey @Greg K. - thank you for going through this with me.. you mentioned: "get the "preview_url" of the shared folder which other users can use to request access to the shared folder for mounting and editing." above.

 

Can you describe how this flow might work in terms of the API?

 

e.g. User #1 sends a text with a sharedLink to User #2.. how can User #2 request access in my app? I wonder if maybe you meant they could request access in Dropbox?

 

 

Highlighted

Re: Sharing - how to share a folder with edit access when don't know my friend's dropbox user id?

Dropboxer
Dropboxer

Sure, this would look like this:

  • the app calls /2/sharing/get_folder_metadata and gets the 'preview_url' for the shared folder from user #1's account (here's an actual sample from a test account: https://www.dropbox.com/scl/fo/dh2dl2yrb4xk52n/AAAzPALQwplEJLHvONWVy1XTa?dl=0 )
  • the app sends that URL to user #2
  • user #2 accesses that URL in their browser
  • user #2 signs in or signs up for Dropbox, if not already signed inScreenshot 2020-04-17 16.11.16.pngScreenshot 2020-04-17 16.11.22.png
  • user #2 uses the "Request access" functionality on that page to request access to the shared folderScreenshot 2020-04-17 16.17.14.png
  • user #1 is notified and can then choose to add user #2 to the shared folderScreenshot 2020-04-17 16.17.28.png
Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Need more support?