Hi @WMS_Dev_user1
Based on my testing, it seems that it is not possible to filter the set of users by given some group ids. The possible way is through the Graph SDK.
var users = await graphClient.Users.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string[] { "memberOf" };
});
foreach (var user in users.Value) {
foreach (var group in user.MemberOf) {
if (group.Id is "{group1 id}" or "{group2 id}" or .......) {
Console.WriteLine("user id: " + user.Id + "\r\n" + "user name: " + user.UserPrincipalName + "\r\n"+ "group id: " + group.Id);
Console.WriteLine("------");
}
}
}
Of course, if anyone has a better solution for this, please feel free to share.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.