Reference

Endpoint Download Message Attachment (Single File)


Name

download_message_attachment

Description

Download a specific attachment linked to the specified message Id. [API reference]

Parameters

Parameter Required Options
Name: UserId

Label: User ID or Email

The Microsoft Mail user ID GUID or email address for the account to read messages from. (Examples: '4ff54a77-9c09-4274-958f-83bdc0a53900' or 'first.last@domain.com')
YES
Name: MessageId

Label: Message ID

The message Id for which to get the attachment from.
YES
Name: AttachmentId

Label: Attachment ID

The attachment Id for the attachment to get.
YES

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
Data DT_NTEXT nvarchar(MAX)
Status DT_STR varchar(4000) 4000
If the column you are looking for is missing, consider customizing Outlook Mail (Office 365) Connector.

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.

Examples

SSIS

Use Outlook Mail (Office 365) Connector in API Source or in API Destination SSIS Data Flow components to read or write data.

API Source

API Source - Outlook Mail (Office 365)
Outlook Mail Connector (Office 365) can be used to integrate Office 365 Outlook Mail API in your App / BI Tools. You can download attachment, read / search Emails, Users, MailFolders, Send email and more.
Outlook Mail (Office 365)
Download Message Attachment (Single File)
Required Parameters
User ID or Email Fill-in the parameter...
Message ID Fill-in the parameter...
Attachment ID Fill-in the parameter...
RequestTimeoutMs Fill-in the parameter...
FileOverwriteMode Fill-in the parameter...
TargetFilePath Fill-in the parameter...
Optional Parameters
SaveContentAsBinary True
RawOutputDataRowTemplate {Status:'Downloaded'}
EnableRawOutputModeSingleRow True
SSIS API Source - Read from table or endpoint

API Destination

API Destination - Outlook Mail (Office 365)
Outlook Mail Connector (Office 365) can be used to integrate Office 365 Outlook Mail API in your App / BI Tools. You can download attachment, read / search Emails, Users, MailFolders, Send email and more.
Outlook Mail (Office 365)
Download Message Attachment (Single File)
Required Parameters
User ID or Email Fill-in the parameter...
Message ID Fill-in the parameter...
Attachment ID Fill-in the parameter...
RequestTimeoutMs Fill-in the parameter...
FileOverwriteMode Fill-in the parameter...
TargetFilePath Fill-in the parameter...
Optional Parameters
SaveContentAsBinary True
RawOutputDataRowTemplate {Status:'Downloaded'}
EnableRawOutputModeSingleRow True
SSIS API Destination - Access table or endpoint

ODBC application

Use these SQL queries in your ODBC application data source:

Download the specified attachment by message ID and attachment ID and save it to a file

SELECT * FROM download_message_attachment
WITH (MessageId='AAMkADIwNz2hODMyLTZiMTQtNDhiMC04OWQzLTc5YTY5M2IyMjk0NABGZAAAAxCbj2hVuNphT74wylrfU4ixBwAbUV6IxRnpQ6qzrb2WfacdAAAAAAEMAAAbUb6IxRnpQrqzrb2WfacdAAAysBnxAAA=',
AttachmentId='AAMkADIwNzNhODMyLTZiMTQtNDhiMC04cWQzLTc5YTY5M2IyMjk0NABGAAAAAACbj2hVuNphTZ4wylrfU4ixBwAbUV6IxRnpQrqzrb2WfacdAAAAAAEMAA8bUV6IxRnpQrqzrb2WfacdAAAysBnxAAABEgAQAK6dg4NuEa5Fmn_5Tp_D_XM=',
TargetFilePath='C:\temp\photo.png'
)

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Download the specified attachment by message ID and attachment ID and save it to a file

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM download_message_attachment
WITH (MessageId=''AAMkADIwNz2hODMyLTZiMTQtNDhiMC04OWQzLTc5YTY5M2IyMjk0NABGZAAAAxCbj2hVuNphT74wylrfU4ixBwAbUV6IxRnpQ6qzrb2WfacdAAAAAAEMAAAbUb6IxRnpQrqzrb2WfacdAAAysBnxAAA='',
AttachmentId=''AAMkADIwNzNhODMyLTZiMTQtNDhiMC04cWQzLTc5YTY5M2IyMjk0NABGAAAAAACbj2hVuNphTZ4wylrfU4ixBwAbUV6IxRnpQrqzrb2WfacdAAAAAAEMAA8bUV6IxRnpQrqzrb2WfacdAAAysBnxAAABEgAQAK6dg4NuEa5Fmn_5Tp_D_XM='',
TargetFilePath=''C:\temp\photo.png''
)';

EXEC (@MyQuery) AT [LS_TO_OUTLOOK_MAIL_OFFICE_365_IN_GATEWAY];