# Mail — Presets

### Summary

* Presets are shortcuts you can pass via `preset` (and sometimes `presetValue`) to quickly filter and sort results without writing filters.
* Applies to: `Mail` → `List` operation.
* Default behavior: Presets commonly apply a default sort by `receivedDateTime desc`. You can still specify `top` yourself.

### Available Presets

#### InboxUnread

* Purpose: show only unread messages.
* Parameters: none.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'InboxUnread', top: 50 }
})
```

#### HasAttachments

* Purpose: only messages that have attachments.
* Parameters: none.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'HasAttachments', top: 50 }
})
```

#### Last7Days

* Purpose: messages from the last 7 days.
* Parameters: none.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'Last7Days', top: 50 }
})
```

#### LastNDays

* Purpose: messages from the last N days.
* Parameters: `presetValue: number` (days). If omitted, defaults to 7. Allowed range: 1..3650.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'LastNDays', presetValue: 14, top: 50 }
})
```

#### SubjectContains

* Purpose: subject contains a specific term.
* Parameters: `presetValue: string` (term). Alias: `term`.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'SubjectContains', presetValue: 'invoice', top: 50 }
})
```

#### FromAddress

* Purpose: only messages from a specific sender email address.
* Parameters: `presetValue: string` (email address). Alias: `address`.

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'List',
  parameters: { preset: 'FromAddress', presetValue: 'billing@contoso.com', top: 50 }
})
```

### Notes

* Presets merge with your explicit parameters. For example, you can still pass `folder`, `top`, or a custom `select`.
* If you specify your own `orderBy`, it takes precedence over the preset's default sort.
