On this page
Sommatic Docs
Open portal

Outlook - Attachments

Download and manage email attachments from Microsoft Outlook via Microsoft Graph API.

View as Markdown
Open in
Connectors Available connectors.microsoft.outlook.attachments Version 1.0.0 Execution: async

Downloads the attachments of one Outlook message through Microsoft Graph, filters them by MIME type and size, and returns them as base64 content or as files on the orchestrator.

Dedicated attachment handler for corporate environments with high-volume email processing. Supports filtering by type, size, pagination for emails with many attachments, and streaming to disk for large files.

Operations:

  • List: Get metadata of all attachments (name, type, size) without downloading content.
  • Download: Download attachment content as base64 or write directly to temporary files.
  • Download All: Download all attachments from a message with optional filtering.

How it works

  1. Resolves the node config and requires connection_id. Gets a Graph token: with client_id, client_secret and tenant_id in the credential secret it requests an app-only token (client credentials); otherwise it uses the secret's token or access_token as is.
  2. Targets /users/<mailbox_email> when mailbox_mode is other, otherwise /me.
  3. Takes the message id from custom_message_id when message_source is custom, otherwise from the incoming item's id.
  4. Lists every attachment of the message, following @odata.nextLink pages.
  5. Keeps the attachments whose contentType starts with filter_content_type and whose size is within filter_min_size and filter_max_size.
  6. Returns no_attachments when nothing is left. Otherwise returns success with content_bytes (base64) per attachment, or, in file mode, writes each one to a new temporary directory and returns its file_path.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-get-pdfs",
  "label": "Get PDF attachments",
  "operator_slug": "connectors.microsoft.outlook.attachments",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "mailbox_mode": "other",
    "mailbox_email": "support@example.com",
    "message_source": "incoming",
    "filter_content_type": "application/pdf",
    "filter_min_size": 1024,
    "output_mode": "content"
  }
}

Configuration

connection_id string Required

Credential for Microsoft Graph API access. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).

mailbox_mode string Optional

Default: token_owner

Allowed values: token_ownerother

mailbox_email string Optional Accepts expressions

Shown when: mailbox_mode = other

message_source string Optional

Incoming: uses the email ID from the previous node. Custom: specify a message ID manually.

Default: incoming

Allowed values: incomingcustom

custom_message_id string Optional Accepts expressions

Shown when: message_source = custom

filter_content_type string Optional Accepts expressions

Optional MIME type filter (e.g., "application/pdf", "image/"). Supports prefix matching.

filter_min_size number Optional

Minimum attachment size in bytes. Useful for filtering out inline images.

filter_max_size number Optional

Maximum attachment size in bytes.

output_mode string Optional

Content: returns base64 in payload. File: writes to /tmp/ and returns file paths (recommended for large attachments).

Default: content

Allowed values: contentfile

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

mailbox_mode
App-only tokens (client credentials) have no /me; use other with mailbox_email for them.
filter_content_type
Case-sensitive prefix match on contentType (for example image/ or application/pdf).
output_mode
file writes under the orchestrator's temporary directory using the attachment name; two attachments with the same name overwrite each other, and the files are not cleaned up by the node.

Output ports

success default

At least one attachment passed the filters. In file mode each item has file_path instead of content_bytes.

Data
{
  "attachments": [
    {
      "id": "AAMkAGI2THVSAAA=",
      "name": "invoice-2026-0418.pdf",
      "content_type": "application/pdf",
      "size": 48213,
      "content_bytes": "JVBERi0xLjcKJc...",
      "is_inline": false
    }
  ],
  "count": 1
}
no_attachments

The message has no attachments, or none passed the filters.

Data
{
  "attachments": [],
  "count": 0
}
error

A validation failed (the output is the envelope { ok, errors, port }) or a Graph call failed (the output is { error, response } with Graph's error body).

Data
{
  "ok": false,
  "errors": [
    "Failed to resolve Microsoft 365 access token"
  ],
  "port": "error"
}

In expressions

What a later node can read from this node's output with $("Outlook - Attachments").item.json.<path> (write your node's label instead of Outlook - Attachments). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.

ExpressionEditorWorker
$("Outlook - Attachments").item.json.attachmentsarray= […] (1)List of attachments with metadata and content/path.
$("Outlook - Attachments").item.json.countnumber= 1Number of attachments found.

Errors

Message Port Cause and fix
Microsoft 365 credential is required error connection_id is empty.
Failed to resolve Microsoft 365 access token error The credential could not be resolved, the token request failed, or the secret has neither client credentials nor a token. The underlying reason is not reported.
Message ID is required. Ensure the previous node outputs an email with an ID, or select "Custom" and provide a Message ID. error The incoming item has no id and no custom id is set.
Request failed with status code <status> error Graph rejected the call: 404 for an unknown message id or mailbox, 401/403 for an expired token or missing Mail.Read permission. See response for Graph's error.

Input contract

id string Optional

Message ID from the trigger or previous node.

Output contract

attachments array Optional

List of attachments with metadata and content/path.

count number Optional

Number of attachments found.

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "connectors.microsoft.outlook.attachments",
  "name": "Outlook - Attachments",
  "category": "integrations",
  "version": "1.0.0",
  "description": "Download and manage email attachments from Microsoft Outlook via Microsoft Graph API.\n\n  Dedicated attachment handler for corporate environments with high-volume email processing. Supports filtering by type, size, pagination for emails with many attachments, and streaming to disk for large files.\n\n  **Operations:**\n  - **List:** Get metadata of all attachments (name, type, size) without downloading content.\n  - **Download:** Download attachment content as base64 or write directly to temporary files.\n  - **Download All:** Download all attachments from a message with optional filtering.",
  "capabilities": [
    "email",
    "attachments",
    "microsoft",
    "outlook",
    "office365"
  ],
  "group": [
    {
      "key": "microsoft",
      "name": "Microsoft",
      "icon_url": "/icons/integrations/microsoft/microsoft.svg"
    },
    {
      "key": "microsoft365",
      "name": "Microsoft 365",
      "icon_url": "/icons/integrations/microsoft/microsoft365.svg"
    }
  ],
  "icon_url": "/icons/integrations/microsoft/outlook.svg",
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "Microsoft 365 Credential",
        "description": "Credential for Microsoft Graph API access. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "oauth2",
            "service-account",
            "object"
          ],
          "types": [
            "outlook",
            "microsoft365",
            "oauth2"
          ]
        }
      },
      "mailbox_mode": {
        "type": "string",
        "title": "Mailbox",
        "enum": [
          "token_owner",
          "other"
        ],
        "default": "token_owner"
      },
      "mailbox_email": {
        "type": "string",
        "title": "Mailbox Email",
        "format": "expression",
        "displayOptions": {
          "show": {
            "mailbox_mode": [
              "other"
            ]
          }
        }
      },
      "message_source": {
        "type": "string",
        "title": "Message Source",
        "enum": [
          "incoming",
          "custom"
        ],
        "default": "incoming",
        "description": "Incoming: uses the email ID from the previous node. Custom: specify a message ID manually."
      },
      "custom_message_id": {
        "type": "string",
        "title": "Message ID",
        "format": "expression",
        "displayOptions": {
          "show": {
            "message_source": [
              "custom"
            ]
          }
        }
      },
      "filter_content_type": {
        "type": "string",
        "title": "Filter by Type",
        "description": "Optional MIME type filter (e.g., \"application/pdf\", \"image/\"). Supports prefix matching.",
        "format": "expression"
      },
      "filter_min_size": {
        "type": "number",
        "title": "Min Size (bytes)",
        "description": "Minimum attachment size in bytes. Useful for filtering out inline images."
      },
      "filter_max_size": {
        "type": "number",
        "title": "Max Size (bytes)",
        "description": "Maximum attachment size in bytes."
      },
      "output_mode": {
        "type": "string",
        "title": "Output Mode",
        "enum": [
          "content",
          "file"
        ],
        "default": "content",
        "description": "Content: returns base64 in payload. File: writes to /tmp/ and returns file paths (recommended for large attachments)."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    },
    "required": [
      "connection_id"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Message ID from the trigger or previous node."
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "attachments": {
        "type": "array",
        "description": "List of attachments with metadata and content/path."
      },
      "count": {
        "type": "number",
        "description": "Number of attachments found."
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Attachments Found",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "no_attachments",
      "label": "No Attachments",
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "tags": [
    "email",
    "attachments",
    "microsoft",
    "outlook",
    "download"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Credentials
Resolved on the server from connection_id; the secret never reaches the workflow.
Capabilities
emailattachmentsmicrosoftoutlookoffice365
Tags
emailattachmentsmicrosoftoutlookdownload

Notes and limits

  • An OAuth access token stored in the credential is used as is and never refreshed; when it expires Graph returns 401.
  • Item and reference attachments carry no contentBytes: content_bytes is null, and in file mode no file is written although file_path is returned.
  • content mode puts every attachment in the workflow state as base64; prefer file for large files. The node does not retry.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs