How can I use the 'in' operator for $filter on Microsoft Graph Mail API?
Asked Answered
F

1

6

I'm trying to use the microsoft graph mail api to query for a small amount of emails using the in operator but cannot find an example.

This is how I am trying to use it: https://graph.microsoft.com/v1.0/me/messages?$filter=(from/emailAddress/address) in '[email protected], [email protected]'

In their documentation, it says that you can use the in operator for $filter.

Framboise answered 12/10, 2020 at 17:15 Comment(1)
Instead of 'in', i used 'eq' and it works for me. You can try that out. graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/… eq '[email protected]'Filtrate
A
4

I am not opposing other answers, I am just leaving this snippet if anyone was looking for IN operator usage format:

$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
Annoying answered 22/1, 2021 at 13:16 Comment(2)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewHilton
@Hilton You are right, but for the time being, I can't find an example in the Microsoft documentation. The snippet I have provided is something I have written by hand that worked.Trinia

© 2022 - 2024 — McMap. All rights reserved.