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

skaros's avatar
skaros
Helpful | Level 6
8 years ago

add members to a file/folder

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

 

  • 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);

     

     

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

    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's avatar
      skaros
      Helpful | Level 6

      Thanks a lot!

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

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff
        I just wrote this for this thread, but I'll make a note to post it on StackOverflow later. Thanks!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,915 PostsLatest Activity: 8 hours 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!