Search code examples
azure-active-directorymicrosoft-graph-apimicrosoft-graph-sdks

How to filter users by assigned plan using Microsoft Graph API


I'm trying the request below. Filtering users by their servicePlanId in assignedPlans property, trying to filter "Phone System" plan.

https://graph.microsoft.com/beta/users?$filter=assignedPlans/any(x:x/servicePlanId eq 4828c8ec-dc2e-4779-b502-87ac9ce28ab7)

And receiving the error message given below inside response body.

"message": "Complex query on property assignedPlans is not supported.",

MS-Graph-Explorer link How can i filter users in this way? And is there any way i can achieve this using ms-graph-java-sdk?


Solution

  • That's a limitation of the current APIs. There a newer engine that allows for more complex queries. To access it you need to add the ConsistencyLevel header with the value eventual and add $count=true as a query parameter.

    Here is a link to the graph explorer with the new query