Getting the colloborated user id of the folder

回答済み
新規投稿

コメント

3件のコメント

  • Jason

    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

    0
    コメントアクション パーマリンク
  • tuser5

    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

    0
    コメントアクション パーマリンク
  • BB_Jake

     

    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());
            }
          }
        }
    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。