Outlook Mail (Office 365) Connector
Documentation
Version: 3
Documentation

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 Label Required Options Description
UserId User ID or Email YES 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')
MessageId Message ID YES The message Id for which to get the attachment from.
AttachmentId Attachment ID YES The attachment Id for the attachment to get.

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Raw Description
Data DT_NTEXT nvarchar(MAX) False
Status DT_STR varchar(4000) 4000 False

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Raw 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 component to read data or in API Destination component to read/write data:

Download Message Attachment (Single File) using API Source

Outlook Mail (Office 365)
Download Message Attachment (Single File)
SSIS API Source - Read from table or endpoint

Download Message Attachment (Single File) using API Destination

Outlook Mail (Office 365)
Download Message Attachment (Single File)
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 [LINKED_SERVER_TO_OUTLOOK_MAIL_OFFICE_365_IN_DATA_GATEWAY];