Skip to main content
Question

Getting the colloborated user id of the folder

  • May 22, 2025
  • 3 replies
  • 21 views

Forum|alt.badge.img

Hi Team,

As a requirement we need to get the collaborated email id/user id's. Could you please share the sample java code snippet if there is any api to get the colloborated email ids.

 

Thanks & Regards,

Kalyan

3 replies

Forum|alt.badge.img

Hi ,

 

Thanks for your question! Box's Java SDK includes comments and snippets on how to return information about collaborations on a file or folder:

https://github.com/box/box-java-sdk/blob/master/doc/collaborations.md

 

Hope that helps!

 

Thanks,

Jason


Forum|alt.badge.img

Hi ,

I have gone through the api but we dont have an option to get the collaborated user id. I tried all the methods of the api but it is not returning the user id. Could you please help me on this.

 

Thanks & Regards,

Kalyan


Forum|alt.badge.img

 

what exactly are you looking for?

 

If you retrieve a list of collaborations for a file or folder, you have access to all users/groups listed as collaborators which includes the user's name and login email address.

 

BoxFolder boxFolder = new BoxFolder(boxAPIConnection, "12345");
    List collaborators = (List) boxFolder.getCollaborations();
    for (BoxCollaboration.Info collaborator : collaborators) {
      if (collaborator.getAccessibleBy() instanceof BoxUser.Info) {
        BoxUser.Info boxUserInfo = (BoxUser.Info) collaborator.getAccessibleBy();
        System.out.println("User name : " + boxUserInfo.getName());
        System.out.println("Email Address : " + boxUserInfo.getLogin());
      } 
      else if (collaborator.getAccessibleBy() instanceof BoxGroup.Info) {
        BoxGroup.Info groupInfo = (BoxGroup.Info) collaborator.getAccessibleBy();
        List boxGroupMembershipInfos = (List) groupInfo.getResource().getMemberships();
        for (BoxGroupMembership.Info membershipInfo : boxGroupMembershipInfos) {
          System.out.println("User name : " + membershipInfo.getUser().getName());
          System.out.println("Email Address : " + membershipInfo.getUser().getLogin());
        }
      }
    }