Is there a Microsoft Graph API to filter and search messages in the same API?

Kognitos 0 Reputation points

I am looking at a use case where a single API helps with filtering and searching simultaneously.

E.g. Search all unread emails with subject "Blah".

When I use $search and $filter in the list messages API, I get the following error:

{'error': {'code': 'SearchWithFilter','message': "The query parameter '$filter' is not supported with '$search'."}}
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,858 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 37,786 Reputation points

    Hi @Kognitos

    The /messages endpoint does not yet support the combination of $filter and $search. For this case, you only need to use the $filter query parameter to filter:$filter=isRead eq false and subject eq 'Blah'

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.