List a list of all member from a group using graph api
Solution 1:
If you want to list all members for a specific group you can create request directly for the specific group. The response type will be IGroupMembersCollectionWithReferencesPage
.
You need to fetch all pages and store result for each page.
List<User> users = new List<User>();
var groupMembers = await Graph.Groups[groupId].Members.Request().GetAsync();
// type of groupMembers.CurrentPage is IList<DirectoryObject>
// User derives from DirectoryObject
// add result for the first page
users.AddRange(groupMembers.CurrentPage.OfType<User>());
// fetch next page
while(groupMembers.NextPageRequest!=null)
{
groupMembers = await groupMembers.NextPageRequest.GetAsync();
users.AddRange(groupMembers.CurrentPage.OfType<User>());
}