We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

venkate's avatar
venkate
Explorer | Level 3
5 years ago
Solved

File sharing with dbx.sharing_create_shared_link

Hi,

 

I am trying to create a sharable link for files in shared folders with visibility control, using Dropbox API

the code I use is 

 

shared_link_metadata = dbx.sharing_create_shared_link("/2. Info/02. GEC-W2B-BMD-GEC-003642-20190127_Weekly Commodity Tracker_P227_TemplateR5.xlsx")
shared_link_metadata.url

 

with this I can get the sharable link with public visibility, However i want to generate links that are only visible to the user with access to the shared folder.

  • First, note that sharing_create_shared_link is deprecated in favor of sharing_create_shared_link_with_settings.

     

    For this use case, it sounds like you may want to create the link like this:

     

    dbx.sharing_create_shared_link_with_settings(path=path, settings=dropbox.sharing.SharedLinkSettings(audience=dropbox.sharing.LinkAudience.no_one))

     

    The "no_one" audience means that the link itself does not grant access; the user would need to have access to the file already, e.g., via the parent shared folder.

1 Reply

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    First, note that sharing_create_shared_link is deprecated in favor of sharing_create_shared_link_with_settings.

     

    For this use case, it sounds like you may want to create the link like this:

     

    dbx.sharing_create_shared_link_with_settings(path=path, settings=dropbox.sharing.SharedLinkSettings(audience=dropbox.sharing.LinkAudience.no_one))

     

    The "no_one" audience means that the link itself does not grant access; the user would need to have access to the file already, e.g., via the parent shared folder.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,033 PostsLatest Activity: 3 years ago
409 Following

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 or Facebook.

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!