MailAttachmentAdd
Summary
Adds a small file attachment to an existing message (draft or sent).
Graph Endpoint
POST /me/messages/{messageId}/attachments
Parameters
Required
messageId: string
— Alias:id
One of:
attachmentIds: number[]
— Up to 10 repository attachment IDs; backend fetches file data and uploads it.name: string
andcontentBytesBase64: string
— Direct upload of a single file (alias:contentBase64
).
Optional
contentType: string
— Defaultapplication/octet-stream
Usage (app.businessFunction)
Using repository attachments (recommended)
app.businessFunction({
functionName: 'MicrosoftGraph',
methodName: 'Mail',
operation: 'AttachmentAdd',
parameters: {
messageId: 'AAMkAGI2N...',
attachmentIds: [1012, 1013] // up to 10
}
})
Single file (base64)
app.businessFunction({
functionName: 'MicrosoftGraph',
methodName: 'Mail',
operation: 'AttachmentAdd',
parameters: {
messageId: 'AAMkAGI2N...',
name: 'report.pdf',
contentBytesBase64: 'JVBERi0xLjQKJc...'
}
})
Response
// When using attachmentIds
{ "ok": true, "attachments": [ { "id": "...", "name": "..", "size": 123456, "contentType": "application/pdf" } ] }
// When uploading a single base64 file
{ "ok": true, "attachment": { "id": "...", "name": "report.pdf", "size": 123456, "contentType": "application/pdf" } }
Notes
Backend uploads via upload sessions (robust for any size). Limit: max 10 attachments per call when using
attachmentIds
.For external clients without repository attachments, use the base64 single-file option or
MailAttachmentUploadLarge
.
See also
MailSend — send a new message with
attachmentIds
in one callMailReply — reply and attach repository files
MailReplyAll — reply-all with attachments
MailForward — forward with attachments
Last updated
Was this helpful?