question

JustinKraft-5082 avatar image
0 Votes"
JustinKraft-5082 asked DanKershaw-5643 answered

groups?$expand=transitiveMembers actually returns members, not transitive members

I've noticed a strange situation that seems like a bug. I'm querying all groups with members expanded:
https://graph.microsoft.com/v1.0/groups?$select=id,displayName&$top=999&$expand=members
111096-image.png


and all groups with transitive members expanded:
https://graph.microsoft.com/v1.0/groups?$select=id,displayName&$top=999&$expand=transitiveMembers
111121-image.png


However, both queries return the same results. In the second case, the 'transitiveMembers' collection is actually just members, not transitive members.

I further confirmed this by explicitly querying for transitive members in each group individually, and this correctly returns the transitive members:
https://graph.microsoft.com/v1.0/groups/<group.id>/transitiveMembers
111105-image.png

Is this expected behavior or a bug? Is there a different way to properly return all groups with transitive members?

Thanks,
-Justin

microsoft-graph-groups
image.png (28.3 KiB)
image.png (26.6 KiB)
image.png (24.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DanKershaw-5643 avatar image
0 Votes"
DanKershaw-5643 answered

Yes - this is (kind of) a bug. Unfortunately $expand does not work "properly" when listing objects and the objects' expanded members (as you have in your query). This API pattern is capped to return only the first 20 expanded members. See https://docs.microsoft.com/en-us/graph/query-parameters?context=graph%2Fapi%2F1.0&view=graph-rest-1.0#expand-parameter and https://docs.microsoft.com/en-us/graph/known-issues#query-parameter-limitations. Personally I would have preferred that this just error as an unsupported query pattern, rather than a half-hearted support - but making that change now would likely be deemed a breaking change.
This is a pattern that we may fully support in the future. @JustineKraft-5537 Please feel free to file a feature request here: https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform/label-name/Microsoft%20Graph

Hope this helps.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.