MailAttachmentUploadLarge

Summary

  • Creates an upload session for large attachments; your client uploads file chunks directly to the provided URL.

Graph Endpoint

  • POST /me/messages/{messageId}/attachments/createUploadSession

Parameters

Required

  • messageId: string — Alias: id

  • One of:

    • attachmentIds: number[] — Up to 10 repository attachment IDs; backend uploads the files completely.

    • name: string — When requesting an upload session (legacy/external upload)

  • size: number

Optional

  • contentType: string — Default application/octet-stream

Usage (app.businessFunction)

app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'AttachmentUploadLarge',
  parameters: {
    messageId: 'AAMkAGI2N...',
    attachmentIds: [2042] // up to 10
  }
})

Requesting an upload session (external upload)

app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'AttachmentUploadLarge',
  parameters: {
    messageId: 'AAMkAGI2N...',
    name: 'video.mp4',
    size: 104857600,
    contentType: 'video/mp4'
  }
})

Response

// When using attachmentIds
{ "ok": true, "attachments": [ { "id": "...", "name": "video.mp4", "size": 104857600, "contentType": "video/mp4" } ] }

// When requesting an upload session
{ "uploadUrl": "https://...", "expirationDateTime": "2024-09-24T10:00:00Z", "nextExpectedRanges": ["0-"] }

Notes

  • Backend handles upload sessions and chunked PUTs for attachmentIds. Limit: max 10 attachments per call.

  • If you request an upload session, upload file chunks to uploadUrl using HTTP PUT with byte ranges as described in Microsoft Graph documentation.

See also

Last updated

Was this helpful?