2
votes

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?

2
if you are successful, could you please share the code with me. I am struggling with this admin-apiReddy

2 Answers

1
votes

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();
0
votes

Add new method to class com.google.api.services.admin.directory.Directory class to query https://www.googleapis.com/admin/directory/v1/groups?userKey={userKey}. This way you can retrieve the member's groups.