View as Markdown
Microsoft Outlook Email icon

Microsoft Outlook Email ACTION

Download Attachment

Download an email attachment to /tmp. Use Find Email to locate the message, then Get Message with includeAttachments: true to get the messageId and attachment id fields. Example: after get-message(messageId="AAMk...", includeAttachments=true) returns attachments: [{ id: "AQMk...", name: "report.pdf" }], call download-attachment(messageId="AAMk...", attachmentId="AQMk...", filename="report.pdf") → writes to /tmp/report.pdf. Set convertToPdf: true to convert images, HTML, plain text, or DOCX files to PDF. For text attachments (text/*, JSON), the response includes fileContent with the decoded text (truncated at 100 KB, flagged by contentTruncated), so the content can be read directly without fetching the file. See the documentation
  • Action
  • Read only
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Microsoft Outlook Email account once, then configure and run Download Attachment from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "microsoft_outlook-download-attachment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    microsoft_outlook: { authProvisionId: "apn_xxxxxxx" },
    messageId: "Message ID",
    attachmentId: "Attachment ID",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Download Attachment inputs
Property Type Description
messageId Message ID string
The Microsoft Graph message ID. Obtain from Find Email or Get Message.
Required
attachmentId Attachment ID string
The attachment ID. Obtain from Get Message with includeAttachments: true — each attachment object in the response has an id field.
Required
filename Filename string
The filename to save the attachment as in /tmp, e.g. report.pdf. If convertToPdf is true, the .pdf extension is applied automatically.
Required
convertToPdf Convert to PDF boolean
When true, converts the attachment to PDF before saving. Supports image, text/plain, HTML, and DOCX files.
Optional
userId User ID string
The user ID or UPN of a shared mailbox. Omit to use the authenticated user's mailbox.
Optional
syncDir SyncDir dir
Required

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
microsoft_outlook-download-attachment
Version
0.1.5
App
Microsoft Outlook Email
Authentication
OAuth
Read-only
Yes
Destructive
No
Open world
Yes