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)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "microsoft_outlook-download-attachment",
"configured_props": {
"microsoft_outlook": { "authProvisionId": "apn_xxxxxxx" },
"messageId": "Message ID",
"attachmentId": "Attachment ID"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "microsoft_outlook",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "microsoft_outlook-download-attachment",
arguments: {
messageId: "Message ID",
attachmentId: "Attachment ID",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| 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
- Source
- View on GitHub ↗