I recently had the need to automatically retrieve and process emails. As I am using Office365 what could have been closer than trying to retrieve the emails via PowerShell and EWS. What I was not aware of is that the supplied Cmdlets that come with the “MSOnlineExtended” module only really deal with account and administration. And the Cmdlet in the OSCEXOEmailMessage module do not retrieve S/MIME messages whe you perform a search like:

#Connect to EWS first
Connect-OSCEXOWebService -Credential $cred

#Search for all messages in inbox
$aMail = Search-OSCEXOEmailMessage -WellKnownFolderName Inbox -From "username@example.com";

I have not yet figured it out why this happens. If anyone knows feel free to share…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.