I'm using the Microsoft graph api to fetch calendar events. Now I would like to only fetch events where one of the attendees has a specific name or email address. An example response describing such an event is
{
"subject": "General meeting",
"attendees": [
{
"emailAddress": {
"name": "Peter Pan",
"address": "peter.pan@neverland.org"
}
},
{
"emailAddress": {
"name": "Captain Hook",
"address": "captain.hook@neverland.org"
}
}
]
}
According to Microsofts documentation the likely way to achieve this is using OData and the any
operator. However I can't find a way to access nested properties like name
and address
using query parameters.
I was hoping I could do something like this
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2022-01-01T00:00:00.000Z&enddatetime=2022-31-01T00:00:00.000Z&$select=attendees,subject&$filter=attendees/any(var:var/emailAddress/address eq 'peter.pan@neverland.org')
but using subparam (emailAddress/address
) like that leads to bad request.
If the emailAddress
field was just an actual email and not another entity, filtering would work.
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2022-01-01T00:00:00.000Z&enddatetime=2022-31-01T00:00:00.000Z&$select=attendees,subject&$filter=attendees/any(var:var/emailAddress eq 'peter.pan@neverland.org')
Is it possible to achieve what I want?
According this comment Graph API doesn't support drilling down multiple levels of relationships.