As per online documentation available here the call for Groups[groupId].Members isn't returning selected user details (e.g. displayName, givenName etc. The response brings accurate items (if a group have 2 members then it will return two object) however, it just returns their IDs, while keeping other details hidden.
To Reproduce (Assuming app registration part and permission setup is done) Create team and assign a member Use Groups[groupId].Members.GetAsync to fetch all the details of members.
Here is the snippet:
_clientSecretCredential = new ClientSecretCredential(tenantId, Helper.Tenant.Get(tenantId).ClientID, Helper.Tenant.Get(tenantId).ClientSecret);
_appClient = new GraphServiceClient(_clientSecretCredential,
// Use the default scope, which will request the scopes
// configured on the app registration
new[] { "https://graph.microsoft.com/.default" });
return await _appClient.Groups[groupId].Members.GetAsync();
I tried selecting exclusively:
return await _appClient.Groups[groupId].Members.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string[] { "id","displayName" };
});
See https://developer.microsoft.com/en-us/graph/graph-explorer for all the properties of member object.
Probably bug in SDK version 5.24. As a workaround you can directly cast users on the server side
return await _appClient.Groups[groupId].Members.GraphUser.GetAsync();
Resource: