简体   繁体   中英

How to filter group members in Microsoft graph API?

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

将 ConsistencyLevel: eventual 添加到您的请求标头(也适用于 v1.0 和 beta)

过滤组成员现在可作为测试版 API 使用

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM