The Exchange Management Shell provides cmdlets that allow you to export email messages from one mailbox to another mailbox. These emails can then be exported to a PST file, or you can open an alternate mailbox and access the data. The only limitation is that this provides no option to export only the message attachments. The EWS Managed API has this functionality built in. In this recipe, you'll learn how to export email attachments from an Exchange mailbox using PowerShell.
Exporting attachments from a mailbox
How to do it...
- First, load the assembly, create the ExchangeService object, and connect to EWS:
Add-Type -Path C:\EWS\Microsoft.Exchange.WebServices.dll $svc = New-Object Microsoft.Exchange.WebServices...