Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve all groups for a member using Google Admin java sdk

I would like to retrieve all groups for a given member. There is an api interface for this: https://developers.google.com/admin-sdk/directory/v1/guides/manage-groups#get_all_member_groups

But unfortunately I can't figure out how to do that using java SDK as I was not able to find a method for this. How can this problem be solved?

like image 618
AKFA Avatar asked Jul 12 '26 16:07

AKFA


1 Answers

You don't need to add methods, you can use Directory.Groups.List and set the userKey parameter, something like

//... imports, initializations etc.

Directory service = new Directory.Builder(httpTransport, jsonFactory,
    credential).build();

Groups userGroups = service.groups().list().setUserKey("[email protected]")
    .execute();
like image 120
Silvano Avatar answered Jul 15 '26 09:07

Silvano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!