July 2017
Intermediate to advanced
648 pages
31h 9m
English
Of course, we'll primarily need to retrieve the message headers for an item in another user's mailbox. Here is an extended version of our previous code that implements EWS impersonation and provides parameters for the mailbox and folder to be searched.
Add the following code to a script called GetMessageHeaders.ps1:
Param($query, $mailbox, $folder) Add-Type -Path C:\EWS\Microsoft.Exchange.WebServices.dll $svc = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService $id = New-Object -TypeName ` Microsoft.Exchange.WebServices.Data.ImpersonatedUserId ` -ArgumentList "SmtpAddress",$mailbox $svc.ImpersonatedUserId = $id $svc.AutoDiscoverUrl($mailbox) $view = New-Object -TypeName ` Microsoft.Exchange.WebServices.Data.ItemView ...
Read now
Unlock full access