Attachments
attachmentsList, view, or download files attached to an email message; inspect metadata, read text-based content, and save to an allowed directory.
Instructions
Inspect or retrieve email attachments. action=list (default) returns metadata for all attachments on messageId (id, name, contentType, size, isInline) — read-only. action=view returns inline content for text/JSON/XML attachments via attachmentId; binary types require download. action=download saves the attachment under a new, unique name in outputDir (default system temp directory, auto-created; must be inside the temp directory, ~/Downloads, ~/Documents or OUTLOOK_EXPORT_DIR) and returns the saved file path. messageId is required for all actions; attachmentId is required for view/download. If messageId came from a shared/delegated mailbox, pass the same sharedMailbox (or alias email) — attachment IDs are scoped to the message and fail under /me otherwise. Use outputVerbosity to control list field count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | Alias for `sharedMailbox`. | ||
| action | No | Action to perform (default: list) | |
| savePath | No | DEPRECATED alias for `outputDir`. Will be removed in a future release. | |
| messageId | Yes | Email message ID (required) | |
| outputDir | No | Absolute directory (or ~/…) to save the file in (action=download, default: system temp directory). Auto-created if missing. Must be inside the system temp directory, ~/Downloads, ~/Documents or OUTLOOK_EXPORT_DIR, with no dot-prefixed folder names. | |
| attachmentId | No | Attachment ID (action=view/download, required) | |
| sharedMailbox | No | Email address of the shared/delegated mailbox the messageId belongs to. Required when the message came from a shared mailbox. Requires delegate access + Mail.Read.Shared. Work/school only; needs the server opt-in setting OUTLOOK_SHARED_MAILBOX (otherwise the call is refused with setup guidance). |