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

Aristide's avatar
Aristide
Helpful | Level 7
4 years ago

Share a file only with added members?

Hello I am using DropBox SDK java v2.

I am using the following method to create the share:

 

 

 public String createLinkDropBox(RecyclerItemCloud itemCloud, String email){

        try {
            List<MemberSelector> newMembers = null;
            if (email != null){
                newMembers = new ArrayList<>();
                MemberSelector newMember = MemberSelector.email(email);
                newMembers.add(newMember);
            }
            SharedLinkSettings sl = new SharedLinkSettings(null,null,null, null, null);
            SharedLinkMetadata sharedLinkMetadata = itemCloud.getDropBoxSevice().sharing().createSharedLinkWithSettings(itemCloud.getPath(),sl);
            if (newMembers != null){
                itemCloud.getDropBoxSevice().sharing().addFileMember(itemCloud.getPath(),newMembers);
            }

            return sharedLinkMetadata.getUrl();

        }  catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

 

 

There are 4 parameters for:

SharedLinkSettings

1 - requestedVisibility

2 - linkPassword

3 - expires

4 - audience

5 - access

 

I can't find the right values for these parameters so that only added members can access the share.

 

Thanks for your help

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    You can use an audience of LinkAudience.NO_ONE when creating the shared link via createSharedLinkWithSettings, so that only those with access to the file (such as granted by addFileMember) can access it.

    • Aristide's avatar
      Aristide
      Helpful | Level 7

      Thank you so much,
      Finally I use the API directly, because I have not found a way to integrate the allow_download parameter in the settings of the method.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks for the note. The 'allow_download' API option hasn't been incorporated into the Java SDK yet, but it should be included the next time the Java SDK is built with the latest version of the API spec.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

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!