Edit

Use the $search query parameter in Microsoft Graph APIs

The $search query parameter is a powerful filtering mechanism in Microsoft Graph that enables you to find specific data by matching search criteria.

Support for this query parameter varies by entity. Some entities, like Microsoft Entra resources that derive from directoryObject, support $search only in advanced queries.

This article explains how to use the $search query parameter effectively with three key resource types: mail messages, people, and Microsoft Entra ID objects (directory objects). You learn the specific syntax requirements, supported properties, and search behaviors for each resource type.

Use $search on message collections

You can search messages based on specific message properties. Search results are sorted by the date and time the message was sent. A $search request returns up to 1,000 results.

When you search messages without specifying message properties, the search targets these default properties: from, subject, and body.

The following example returns all messages in the signed-in user's Inbox that contains "pizza" in any of the three default search properties:

GET https://graph.microsoft.com/v1.0/me/messages?$search="pizza"

Alternatively, you can search messages by specifying message property names that Keyword Query Language (KQL) syntax recognizes. These property names correspond to properties defined in the message entity of Microsoft Graph. Outlook and other Microsoft 365 applications like SharePoint support KQL syntax, which provides a common discovery domain for their data stores.

Searchable email property Description Example
attachment Names of files attached to an email message. GET ../me/messages?$search="attachment:api-catalog.md"
bcc The bcc field of an email message, specified as an SMTP address, display name, or alias.