ODBC guide

Download a message as .EML file


Downloads a single message as an .EML file (RFC 822 / MIME). Supply Message Id, User Id, and MailFolder Id; the message is saved to the path given in TargetFilePath. The file can be opened in most email clients and includes 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
)