> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Search messages

> Search Outlook mail with Microsoft Graph message search syntax.

`searchMessages` performs Graph message search and returns matching metadata.

## Example

```ts automations/search-outlook-mail.automation.ts theme={null}
import { automation } from "automate.ax"
import { searchMessages } from "automate.ax/outlook"

export default automation("Find launch mail", () => {
  searchMessages({
    folder: "inbox",
    query: "subject:launch from:alex@example.com",
    limit: 50,
  })
})
```

## Inputs

| Input     | Type                                                 | Required | Default         | Description                                                                      |
| --------- | ---------------------------------------------------- | -------- | --------------- | -------------------------------------------------------------------------------- |
| `query`   | `string`                                             | Yes      | —               | Microsoft Graph message search expression. Quotes are escaped before submission. |
| `folder`  | `string`                                             | No       | Entire mailbox  | Display path, ID, or well-known folder name.                                     |
| `limit`   | `number`                                             | No       | `100`           | Maximum results across pages, 1–10,000.                                          |
| `account` | `string \| IntegrationAccountReference<"microsoft">` | No       | Project default | Microsoft binding.                                                               |

## Output

Returns matching message metadata without body or preview. Search syntax and
index availability are controlled by Microsoft Graph; malformed expressions
fail at the provider.
