One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
Aristide
4 years agoHelpful | Level 7
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
Dropbox 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.
- AristideHelpful | 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
Dropbox 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
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 hours ago
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!