4

Issue:

I am retrieving Group Members using Microsoft Graph API. I need to order the results based on the 'displayName'. Doing this on its own, works fine. I also need to know whether the members returned potentially has any of its own members. I therefore add the expand (members) to my OData query. The expand works, but the original orderBy then fails to order.

It seems that you can use Expand and Orderby on the 'Groups' call, but not on the 'Members' call.

Graph Explorer:

Works:

Only Orderby on Group Members:

https://graph.microsoft.com/v1.0/groups/{groupId}/members/microsoft.graph.group?$orderby=displayName

Expand & Orderby on Only Groups:

https://graph.microsoft.com/v1.0/groups?$expand=memberOf($filter=not memberOf/any())&$orderby=displayName

**With the request header: ConsistencyLevel: eventual

Doesn't work:

Expand & Orderby on Group Members:

https://graph.microsoft.com/v1.0/groups/{groupId}/members/microsoft.graph.group?$orderby=displayName&$expand=members

Documentation:

I can't seem to find anywhere where the documentation flags this as an issue. The closest I could find was the "Known Issues" page stating that "$expand: No support for @odata.nextLink. No support for more than 1 level of expand. No support with extra parameters ($filter, $select)."

https://learn.microsoft.com/en-us/graph/known-issues?view=graph-rest-1.0#query-parameter-limitations

These only flag filter and select... Also, this does not explain why I can use Expand, Filter and OrderBy all combined with the Groups call, but not with the Members call

Other notes:

I've been testing using both Microsoft Graph Explorer as well as the .Net SDK (version 3.25 and latest 4.0). Both of these give the same issue.

**Also: There is an existing open bug for the .NetSDK that does not allow casting to a Group when doing the Members call. I do not have an issue with this and am currently using a workaround:

https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/836

Picture Explanation:

enter image description here

Johan Mostert
  • 111
  • 1
  • 4
  • The way it's phrased, I don't take those two "extra" parameters they gave to be an exhaustive list, just examples. But it's ambiguous enough that I think it'd be fair to open a support request on it, if no one here can provide a solution. – Noah Jul 26 '21 at 16:35
  • For example : we have Group1 and Group2 and group2 is a member of group1 and has some users .. May I know what you are trying to order after expand , the groups or the group members present in group2. ? – Ansuman Bal Aug 02 '21 at 15:20
  • 1
    @Noah thanks for the reply. I've updated the question. Making that assumption would make sense, however, it looks like the ".Group" call allows the combination while the ".Members" call does not. – Johan Mostert Aug 06 '21 at 10:14
  • @AnsumanBal-MT thanks for the reply. I've updated the question and added a heading called "Picture Explanation" with a picture beneath. Hopefully it helps with the explanation. I'm trying to (1) orderBy on the initial list of 'Members' while also (2) expanding the members of the same initial list of 'Members' – Johan Mostert Aug 06 '21 at 10:17

1 Answers1

0

the answer : https://learn.microsoft.com/fr-fr/graph/aad-advanced-queries

need to add $count=true

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 19 '22 at 19:06