Endpoint Download Message by Id (Single *.EML File RFC 822 / MIME)
Name
download_message
Description
Downloads a single message as *.EML File type (RFC 822 / MIME) for a specified Message Id / mailbox / folder
Parameters
Parameter | Required | Options | ||||||
---|---|---|---|---|---|---|---|---|
Name:
Label: MessageId |
YES | |||||||
Name:
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:
Label: SaveFolder Specify a disk folder path to save file(s) to |
YES | |||||||
Name:
Label: MailFolderId |
||||||||
Name:
Label: OverwriteFile |
|
Output Columns
Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
---|---|---|---|---|
StatusCode |
DT_I4
|
int
|
||
ErrorMessage |
DT_STR
|
varchar(4000)
|
4000 | |
MessageId |
DT_STR
|
varchar(255)
|
255 | |
UserId |
DT_STR
|
varchar(255)
|
255 | |
MailFolderId |
DT_STR
|
varchar(255)
|
255 | |
SavedFileSize |
DT_I8
|
bigint
|
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
Required Parameters | |
---|---|
MessageId | Fill-in the parameter... |
User ID or Email | Fill-in the parameter... |
SaveFolder | Fill-in the parameter... |
Optional Parameters | |
MailFolderId | |
SaveContentAsBinary | True |
OverwriteFile | True |
Continue processing on 404 error | True |
EnableCustomReplace | True |
SearchFor | ^\s*$--regex |
ReplaceWith | {} |

API Destination
Required Parameters | |
---|---|
MessageId | Fill-in the parameter... |
User ID or Email | Fill-in the parameter... |
SaveFolder | Fill-in the parameter... |
Optional Parameters | |
MailFolderId | |
SaveContentAsBinary | True |
OverwriteFile | True |
Continue processing on 404 error | True |
EnableCustomReplace | True |
SearchFor | ^\s*$--regex |
ReplaceWith | {} |

ODBC application
Use these SQL queries in your ODBC application data source:
Download Outlook Emails as .EML File (RFC 822 / MIME Format)
This example shows how to export/download Office 365 Email message as EML file (RFC 822 / MIME) using Message Id / User Id and MailFolder Id. It will save message as its own local file. This file type can be opened by most email clients, *.eml file saves along with attachments.
SELECT * FROM
download_message
WITH(
MessageId='AAMkADliN2RmZGM4..........3JFHGAAf2n2J-AAA=',
SaveFolder='c:\temp',
OverwriteFile='True',
--UserId='me', --or use "user-id" or use "email"
--UserId='someuser@mycompany.onmicrosoft.com',
--UserId='1487fe8b-f09f-4015-a817-b8b9fe2a3edc',
MailFolderId='INBOX' --or use mailbox ID
)
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
Download Outlook Emails as .EML File (RFC 822 / MIME Format)
This example shows how to export/download Office 365 Email message as EML file (RFC 822 / MIME) using Message Id / User Id and MailFolder Id. It will save message as its own local file. This file type can be opened by most email clients, *.eml file saves along with attachments.
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM
download_message
WITH(
MessageId=''AAMkADliN2RmZGM4..........3JFHGAAf2n2J-AAA='',
SaveFolder=''c:\temp'',
OverwriteFile=''True'',
--UserId=''me'', --or use "user-id" or use "email"
--UserId=''someuser@mycompany.onmicrosoft.com'',
--UserId=''1487fe8b-f09f-4015-a817-b8b9fe2a3edc'',
MailFolderId=''INBOX'' --or use mailbox ID
)';
EXEC (@MyQuery) AT [LS_TO_OUTLOOK_MAIL_OFFICE_365_IN_GATEWAY];