cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

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: 

add members to a file/folder

add members to a file/folder

skaros
Helpful | Level 6
Go to solution

Hi,

I am using the dropbox-sdk-java, via Maven, and i unable to find a way to add members to a file(and later to a folder).

Could you provide with some pointers?

I think i have to use

DbxRawClientV2

DbxUserSharingRequests

But for one, i can not itialize DbxRawClientV2, if I try

DbxRequestConfig config = new DbxRequestConfig("example/DbApi");
DbxRawClientV2 rawClient=new DbxRawClientV2(config, getToken(AuthorizationFile));

I am getting

Cannot instantiate the type DbxRawClientV2

Thanks

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

You don't need to use DbxRawClientV2. You should instead use DbxClientV2, as shown in the examples, e.g., here.

 

Calling addFileMember would look like this:

 

DbxRequestConfig config = new DbxRequestConfig("example");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);

List<MemberSelector> newMembers = new ArrayList<MemberSelector>();
MemberSelector newMember = MemberSelector.email("dbapitesting@gmail.com");
newMembers.add(newMember);

List<FileMemberActionResult> fileMemberActionResults = client.sharing().addFileMember("/test.txt", newMembers);
System.out.print(fileMemberActionResults);

 

 

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

You don't need to use DbxRawClientV2. You should instead use DbxClientV2, as shown in the examples, e.g., here.

 

Calling addFileMember would look like this:

 

DbxRequestConfig config = new DbxRequestConfig("example");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);

List<MemberSelector> newMembers = new ArrayList<MemberSelector>();
MemberSelector newMember = MemberSelector.email("dbapitesting@gmail.com");
newMembers.add(newMember);

List<FileMemberActionResult> fileMemberActionResults = client.sharing().addFileMember("/test.txt", newMembers);
System.out.print(fileMemberActionResults);

 

 

skaros
Helpful | Level 6
Go to solution

Thanks a lot!

Why dont you add these on StackOverflow docs? It would be usefull for everyone to see

Greg-DB
Dropbox Staff
Go to solution
I just wrote this for this thread, but I'll make a note to post it on StackOverflow later. Thanks!
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    skaros Helpful | Level 6
What do Dropbox user levels mean?