0

I have two team ids which I want to search in one query. I already tried some possible queries like one blow but nothing working

https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team') and id eq ['13be6971-79db-4f33-9d41-b25589ca25af', '02bd9fd6-8f93-4758-87c3-1fb73740a315]'

this is the error message that this query is giving { "error": { "code": "BadRequest", "message": "Invalid filter clause", "innerError": { "request-id": "ced5a7c7-73a1-49bb-afc1-3f312bac8759", "date": "2019-09-11T08:11:58" } } }

To use graph API explorer you can click here https://developer.microsoft.com/en-us/graph/graph-explorer#

3 Answers 3

2

Given that you use v1.0 api version instead of beta, then the IN query should be possible:

$filter=displayName in ('group-1', 'group-2')

Full url example after encoding:

https://graph.microsoft.com/v1.0/groups?$filter=displayName%20in%20%28%27group-1%27%2C%20%27group-2%27%29

Btw this was written by hand - I found no Microsoft documentation example how to build IN operator query.

1

The in filter operator does not seem to be supported by Graph up to now, hence the error. At least it is not mentioned to be supported in the documentation:

Support for $filter operators varies across Microsoft Graph APIs. The following logical operators are generally supported:

  • equals (eq)
  • not equals (ne)
  • greater than (gt)
  • greater than or equals (ge)
  • less than (lt),
  • less than or equals (le)
  • and (and)
  • or (or)
  • not (not)

If you have a limited set of values for the in clause, you could use eq and or, e.g.

https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team') and (id eq '13be6971-79db-4f33-9d41-b25589ca25af' or id eq '02bd9fd6-8f93-4758-87c3-1fb73740a315')
3
  • Thanks Markus! yes its working, we can use the same for in operator like <br>graph.microsoft.com/v1.0/groups?$filter= (id eq '67e08701-4d78-4086-a019-4b499a3ab57f' or id eq '5ab4b1ee-51fe-4c7c-9a36-6e1dd9636445') Dec 18, 2019 at 10:44
  • Has anyone found out a working solution on how to use the in filter clause? Dec 8, 2022 at 3:20
  • I have checked the documentation, and no proper solution found The following is a description from the official documentation learn.microsoft.com/en-us/graph/… The in operator is supported by default whenever eq operator is supported by default. Dec 8, 2022 at 3:22
0

Found this on Microsoft documentation

List all users whose company name is either undefined or Microsoft. GET ../users?$filter=companyName in (null, 'Microsoft')&$count=true. This is an advanced query.

[https://learn.microsoft.com/en-us/graph/query-parameters#filter-parameter][1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.