.netgoogle-groupsgoogle-api-dotnet-clientgoogle-groups-apigoogle-admin-settings-api

List suspended group members


Following on from my previous question, I am trying to retrieve a list of members for a given group using the new Google Admin Directory API and the current client library, Google.Apis.Admin.directory_v1.

I have the following code (possibly not the best approach, but it works :):

var members = new List<Member>();

// This is the key part
var request = _directoryService.Members.List(groupKey);
var result = request.Execute();

if (result.MembersValue != null)
    members.AddRange(result.MembersValue);

// Get subsequent pages
while (! string.IsNullOrEmpty(result.NextPageToken)) {
    request.PageToken = result.NextPageToken;
    result = ExecuteRequest(request);

    if (result.MembersValue != null)
        members.AddRange(result.MembersValue);
}

This works fine, but has one problem: the results (the members list) does not contain those members who are in the group but are suspended. These are listed in the domain admin UI at admin.google.com, but don't appear in the list returned by the API.

Is there any way to bring them in? Basically, I'm after all members (or owners, managers), regardless of their suspended-ness.

I've taken a look at the documentation, but am seeing nothing.


Solution

  • The admin group is familiar with this issue and they are working on to surface suspended/pending/banned members of the group in the Admin SDK Directory API. It should be fixed soon.