How to search users in groups and return display names using graph API?

Net core application. I have search box in web application where user can search user belongs to specific group. I am trying as below to search users

var members = await graphClient.Groups["0001b29c-fd90-4ae9-a5a1-h8afe65777e9"].Request().Expand("members").GetAsync();
var usersInGroup = members.Members.ToList();

In the above code I want to apply filter also to list users name starting with. I am struggling to apply filter. Can someone help me to add filters here. Any help would be greatly appreciated. thank you

Upvotes: 1

Views: 1221

Answers (1)

Sruthi J
Sruthi J

Reputation: 1602

Please try below API to search users in groups

 https://graph.microsoft.com/beta/groups/groupid/members/microsoft.graph.user?$count=true&$orderby=displayName&$search="displayName:sr"&$select=displayName,id

ConsistencyLevel: eventual

enter image description here

Upvotes: 1

Related Questions