# MailSearch

### Summary

* Full‑text search in messages using AQS (Advanced Query Syntax), with paging and optional counts.

### Graph Endpoint

* `GET /me/messages?$search=...`

### Parameters

#### Required

* `search: string` — Your AQS query. Quotes are added automatically.

#### Optional

* `select: string[]`
* `top: number` — 1..100
* `count: boolean`
* `folder: string` — Folder id or well‑known name

### Usage (app.businessFunction)

#### Minimal

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'Search',
  parameters: {
    search: 'from:contoso subject:"invoice"'
  }
})
```

#### With options

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'Search',
  parameters: {
    search: 'from:contoso',
    select: ['id','subject','from','receivedDateTime','webLink'],
    top: 50,
    count: true,
    folder: 'Inbox'
  }
})
```

### Response

```json
{
  "items": [ { "id": "...", "subject": "..." } ],
  "nextLink": "...",
  "count": 42
}
```

### Notes

* When using search, ordering is not applied.
