5
votes

I was sure about after reading Microsoft document that I can filter the group members using OData Query Parameters because https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/group_list_members

Request GET URL - https://graph.microsoft.com/v1.0/groups/{groupId}/members?filter= startswith(givenname,'V')

In above URL groupId is used from https://graph.microsoft.com/v1.0/groups

but when I try to get the result using Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer) using my work account login, it's not working.

Also I have tried to use this in SDK (I have implemented graph API in my code using Microsoft graph API SDK) and still got same error.

And gives below error -

{ "error": { "code": "Request_UnsupportedQuery", "message": "The specified filter to the reference property query is currently not supported.", "innerError": { "request-id": "96f3ffef-56f5-42e3-82f2-64813106b729", "date": "2018-02-13T10:59:39" } } }

Is this because "members" is not a resource type ? so it does not have properties and so we can not filter this result ?

If so then is there any other way we can get filtered group members ?

Also posted issue on Github - https://github.com/microsoftgraph/microsoft-graph-docs/issues/2239

2
I believe it is because /members returns a list of directoryObjects. Even though the user resource inherits from directoryObject, you can't filter on givenName here. You would have to do client-side filtering to search for specific members.RasmusW
Per my testing, both Microsoft graph and Azure AD graph could not support the filter query against group members as you mentioned. You may retrieve all the members under a specific group and filter them in your client as RasmusW commented. Or you could add your feature request to Microsoft Graph team.Bruce Chen
@BruceChen thanks. Microsoft documentation should be corrected then that we can not filter group members.vishwajeetrkale
I've created a UserVoice suggestion for this: officespdev.uservoice.com/forums/…Thomas

2 Answers

1
votes

Add ConsistencyLevel: eventual to Your request header (should work for v1.0 and beta as well)

0
votes

Filtering of group members is now available as a beta API.

GET https://graph.microsoft.com/beta/groups/{id}/members?$count=true&$filter=startswith(displayName, 'a')