This script can export email messages from Outlook Web App to a specific folder. These email messages will be saved in .eml format.
You need to find the email
messages by using search folder.

Download the Script from here

Important Note:
Scripting is NOT supported by Microsoft Technical Support.
You have to use this script on your own risk as each environment is different for each user. 

Microsoft Outlook allows you to export email messages very easily. However, this feature is not available in the Outlook Web App (OWA).
Therefore, in order to export
email messages from OWA, you must find a workaround.

This script requires Exchange Web Service Managed API 2.0. Please download and install the package from Microsoft Download Center.
This script cannot work correctly without this package.

Let's start and execute the script… 

1.Open Windows Azure Active Directory PowerShell


2.Run Import-Module cmdlet to import this module file

Import-Module filepath\scriptname.psm1

Import-Module C:\Export\ExportOSCEXOEmailMessage.psm1

To display help about this function, run this command.
Get-Help Export-OSCEXOEmailMessage -Full


To initiate a connection to Office 365 Exchange Online, please run this command.
You must run this example before any other step.
Connect-OSCEXOWebService -Credential (Get-Credential


Note The Connect-OSCEXOWebService function creates a new variable called exService.
This variable is in the global scope of the current
Windows PowerShell session.
This variable is used by other functions in the

To create a search folder that contains the email messages with specific subject, please run this command.
New-OSCEXOSearchFolder -DisplayName "Subject contains 'Backup'" -Subject "Backup" -StartDate "07/20/2013 12:00:00 AM" -EndDate "09/25/2013 12:00:00 PM"


To export email messages in a search folder and keep this search folder after exporting, please run this command.
Get-OSCEXOSearchFolder -DisplayName "Subject contains 'Backup'" | Export-OSCEXOEmailMessage -Path C:\Backup -KeepSearchFolder

To export email messages in a temporary search folder, please run this command.
New-OSCEXOSearchFolder -Subject "Test email" | Export-OSCEXOEmailMessage -Path C:\Backup



 Additional Resources Technical Resources: