Skip to content

Microsoft: Invoke action create Upload Session — me Mail Folder mail Folders Messages Attachments Create Upload Session

Microsoft meMailFolder.mailFoldersMessagesAttachmentsCreateUploadSession: arguments, response, policy and SDK examples.

← Me mail folder operations · Get started

Operation microsoft.me_mailfolders_mailfolder_messages_message_attachments_createuploadsession

Provider route: POST /me/mailFolders/{mailFolder-id}/messages/{message-id}/attachments/createUploadSession. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/microsoft with npm, or alter-sdk-microsoft with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { MicrosoftIntegration } from "@alter-ai/microsoft";
async function execute(input: Parameters<MicrosoftIntegration["meMailFolder"]["mailFoldersMessagesAttachmentsCreateUploadSession"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new MicrosoftIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.meMailFolder.mailFoldersMessagesAttachmentsCreateUploadSession(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_microsoft import MicrosoftIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = MicrosoftIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.me_mail_folder.mail_folders_messages_attachments_create_upload_session(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.mailFolder-idstringRequired within parent
path.message-idstringRequired within parent
bodyobjectRequired within parent
body.AttachmentItemModelOptionalExpand Invoke action create Upload Session — me Event events Attachments Create Upload Session — request body — body Attachment Item

Referenced models: Invoke action create Upload Session — me Event events Attachments Create Upload Session — request body — body Attachment Item

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)ModelAlternativeExpand Invoke action create Upload Session — me Event events Attachments Create Upload Session — response body — @odata type, expiration Date Time, next Expected Ranges, upload Url
$ (anyOf 2)JSONAlternative
$ (anyOf 2) (anyOf 1)objectAlternative
$ (anyOf 2) (anyOf 2)nullAlternative

Referenced models: Invoke action create Upload Session — me Event events Attachments Create Upload Session — response body — @odata type, expiration Date Time, next Expected Ranges, upload Url

Invoke action create Upload Session — me Event events Attachments Create Upload Session — response body — @odata type, expiration Date Time, next Expected Ranges, upload Url
FieldTypePresenceDescription and constraints
$objectRoot
@odata.typestringOptional
expirationDateTimeJSONOptional
expirationDateTime (anyOf 1)stringAlternativeThe date and time in UTC that the upload session expires. The complete file must be uploaded before this expiration time is reached. Each fragment uploaded during the session extends the expiration time.
Format: date-time
Pattern: ^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$
expirationDateTime (anyOf 2)nullAlternative
nextExpectedRangesarrayOptionalA collection of byte ranges that the server is missing for the file. These ranges are zero indexed and of the format 'start-end' (for example '0-26' to indicate the first 27 bytes of the file). When uploading files as Outlook attachments, instead of a collection of ranges, this property always indicates a single value '{start}', the location in the file where the next upload should begin.
nextExpectedRanges[]JSONEach item
nextExpectedRanges[] (anyOf 1)stringAlternative
nextExpectedRanges[] (anyOf 2)nullAlternative
uploadUrlJSONOptional
uploadUrl (anyOf 1)stringAlternativeThe URL endpoint that accepts PUT requests for byte ranges of the file.
uploadUrl (anyOf 2)nullAlternative
Invoke action create Upload Session — me Event events Attachments Create Upload Session — request body — body Attachment Item
FieldTypePresenceDescription and constraints
$objectRoot
@odata.typestringOptional
attachmentTypeJSONOptionalThe type of attachment. The possible values are: file, item, reference. Required.
attachmentType (anyOf 1)stringAlternativeOne of: file, item, reference
attachmentType (anyOf 2)JSONAlternative
attachmentType (anyOf 2) (anyOf 1)objectAlternative
attachmentType (anyOf 2) (anyOf 2)nullAlternative
contentIdJSONOptional
contentId (anyOf 1)stringAlternativeThe CID or Content-Id of the attachment for referencing for the in-line attachments using the <img src='cid:contentId'> tag in HTML messages. Optional.
contentId (anyOf 2)nullAlternative
contentTypeJSONOptional
contentType (anyOf 1)stringAlternativeThe nature of the data in the attachment. Optional.
contentType (anyOf 2)nullAlternative
isInlineJSONOptional
isInline (anyOf 1)booleanAlternativetrue if the attachment is an inline attachment; otherwise, false. Optional.
isInline (anyOf 2)nullAlternative
nameJSONOptional
name (anyOf 1)stringAlternativeThe display name of the attachment. This can be a descriptive string and doesn't have to be the actual file name. Required.
name (anyOf 2)nullAlternative
sizeJSONOptional
size (anyOf 1)numberAlternativeThe length of the attachment in bytes. Required.
Format: int64
size (anyOf 2)nullAlternative

SDK function policy ID: microsoft.me_mailfolders_mailfolder_messages_message_attachments_createuploadsession. Catalog operation: me_mailfolders_mailfolder_messages_message_attachments_createuploadsession. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.