Arjun Tina
Arjun Tina

Reputation: 23

Expanding and Filtering MS Graph API Does Not Work

I need to get an eventMessage from a user's mailbox that is associated with a specific event.

I have the event's iCalUId but I am unable to filter on it:

/users/${roomEmailAddress}/messages
?$expand=microsoft.graph.eventMessage/event($filter=iCalUId eq '${iCalUId}')

What I am trying to do is get all messages, then expand so that I see the events associated with each message, then filter each event to find the one I care about.

However, I get a response with all events and the filtering mechanism is not working.

Where am I going wrong?

Upvotes: 1

Views: 2518

Answers (2)

Pesa
Pesa

Reputation: 341

This worked for me, first I filtered then I expanded list

https://graph.microsoft.com/v1.0/sites/{sideID}/lists/{listID}/items?$filter=fields/{Name of Field} eq '{VALUE}'&$expand=fields

Upvotes: 1

Marc LaFleur
Marc LaFleur

Reputation: 33132

Graph doesn't support including a $filter in the $expand. From the documentation:

$expand:

  • No support for nextLink
  • No support for more than 1 level of expand
  • No support with extra parameters ($filter, $select)

What you can do is leverage the $search parameter to parameter to find all of the event messages ($search="kind:meetings) and then $expand the associated event:

/me/messages?$search="kind:meetings"&$expand=microsoft.graph.eventMessage/event

Upvotes: 2

Related Questions