using $search and $filter parameters for messages endpoint

Teo Toplak 0 Reputation points
2023-10-23T10:44:32.0066667+00:00

As per Graph Email API message docs $search and $filter parameters cannot be used together while querying message collections.

$filter doesn't support querying to, cc, bcc, and $search doesn't support in, unread, flag properties. Essentially this there is no fully-covered search of message collection endpoint. I have couple of questions related to this:

  1. Why neither of those parameters don't allow searching per properties that are a frequent use case for messages? Do you plan on extending feature support for one or another?
  2. Do you have any advises on some solution that could fully cover message search? Example here is a query that would search for messages that has both to and unread defined.
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. v-pd 10 Reputation points Microsoft External Staff
    2023-12-13T18:20:05.2733333+00:00

    The Microsoft Graph API’s $search and $filter parameters have different functionalities and are designed to work on different properties of the message collections.

    The $search parameter is used to restrict the results of a request to match a search criterion. It can search messages based on a value in specific message properties such as from, subject, body, bcc, cc, and attachment. See: https://learn.microsoft.com/en-us/graph/search-query-parameter?tabs=http

    On the other hand, the $filter parameter is used to retrieve a subset of a collection. It evaluates an expression for each resource in the collection, and only items where the expression evaluates to true are included in the response. See: https://learn.microsoft.com/en-us/graph/search-query-parameter?tabs=http

    This is by design. However, you provide your feedback here: https://feedbackportal.microsoft.com/feedback/forum/ebe2edae-97d1-ec11-a7b5-0022481f3c80

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.