I'm converting my application over to the directory API and am trying to find a way to pull a user's group membership in google using .NET.
Looking at the API page: Google Apps API
I see "Retrieve a Group's Member" that requires both a group and a member's key. I can't find this call in the service.Groups functions. I also looked at the service.Membership functions and I'm not finding anything.
Where is the API that pulls a single user's group membership?
Update:
This is the call I'm attempting to use:
try
{
GroupsResource.ListRequest groups = service.Groups.List();
groups.Domain = "appDomain.com";
groups.Customer = strGoogleCusID;
groups.MaxResults = 100;
groups.PageToken = "";
groups.UserKey = "User@appDomain.com";
var list = groups.Execute();
}
catch (Google.GoogleApiException ex)
{
}
But it returns bad request. I can use this function to return all groups in a domain, but if I specify the UserKey I get 400 Bad Request.
You can use the Groups -> list API where a userKey can be specified. It returns all the groups the user is a memberOf. Here's the link - https://developers.google.com/admin-sdk/directory/v1/reference/groups/list