Getting the colloborated user id of the folder
回答済み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
-
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
-
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()); } } }
サインインしてコメントを残してください。
コメント
3件のコメント