Hi @Pardeep Kumar,
After Microsoft.Graph version 5.0, calling the GetGroupMembers method has been deprecated, because you updated the version, so you can no longer get Group memberships like this, I have tested for your needs and successfully returned the result, my code is as follows, please try the following.
using Microsoft.Graph.Users.Item.GetMemberGroups;
var requestBody = new GetMemberGroupsPostRequestBody
{
SecurityEnabledOnly = false,
};
var userId = "{user-id}";
var groupsUser = Task.Run(async() => await graphClient.Users[userId].GetMemberGroups.PostAsGetMemberGroupsPostResponseAsync(requestBody)).Result;
For more usage, please refer to the link below.
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.