Fellow MVP Glen Scales has created a really nice example of the power of Exchange Web Services (EWS) to build an Exchange 2010 email client that you can run through a PowerShell script (for more details of the script, see Glen’s blog). I like this code a lot because it allows you to run an email client on a workstation for test purposes without having to install Outlook or run up OWA (yes, I know OWA is a great client, especially in Exchange 2010 SP1, but sometimes it’s just too slow to start on a virtual machine running on a laptop).
Glen’s client works with V1.0 of EWS, which you can download from Microsoft. You need to install EWS and PowerShell on the workstation that you want to run the client. You’ll also need access to the Exchange 2010 cmdlets, which you can gain by either running the Exchange Management Shell (in which case you have to install the Exchange 2010 management components), or you can make a remote connection to an Exchange 2010 server using the code explained here.
To start, you put the script (I renamed it SimpleClient.ps1 to make it pretty obvious what the purpose of the script is so that I could remember it in the future) into whatever directory you use for PowerShell scripts and fire it up with:
The script loads a form (shown below) to collect connectivity data such as the email address of the mailbox that you want to use and credentials if you need to provide them. By default the script uses the account and the credentials that you’ve logged in with. The script will use Autodiscover by default to find the EWS web service but you can feed it a specific URL if you want for testing (such as https://ExServer1.contoso.com/ews/exchange.asmx).
Once connected, you’ll see the folder structure in the mailbox and be able to navigate within it to go to a specific folder. The current version of the client doesn’t support archive mailboxes, but I believe that Glen is working on an update using Exchange Web Services V1.1 that will support this feature.
You can click on a message to view its contents or its header or export it to a file, or send a test message from the mailbox. Behind the scenes, the script runs to process the commands sent from the form. You can expose EMS to see the commands that are executed and gain some insight into what’s going on.
I won’t pretend that this is a client that everyone will be excited about, but it is something that I think is of value to many administrators or anyone who wants to dabble with Exchange Web Services. Remember, now that WebDAV has bitten the proverbial dust, EWS is the way forward if you want to access Exchange mailbox and message data, so anything that throws more light onto that subject is welcome.