Skip to main content


Showing posts from February, 2012

HowTo Series Sample 2 - Accessing System Public Folders : OAB Stats script

The following script demonstrates how you can access System Level Public Folders (Non_IPM_Subtree) using the EWS Managed API and shows how to report on the status of the OAB (Offline Address Book) distribution folders. (Note on 2010 you can also do this with the Exchange Management Shell). It produces a CSV report like The main script is based around the how to series template but because there is no enumeration to get to the Non_IPM_Subtree one trick is needed. The first thing is to bind to the normal Public Folder Root using PublicFoldersRoot Enum then use the ParentFolderId property of this folder to bind to the parent then search  for the Non_IPM_Subtree folder which will be a subfolder of this folder. Then you can query for any System Folder from this point in this example it finds the OAB folder queries for any subfolders under this folder and then finds any of these subfolders with Items and queries the size, number of Items and the Modified date of the last item. I'

HowTo Series Sample 1 - Unused Mailbox report for Exchange 2010

The is the first of my samples based on the EWS Managed API and Powershell how to series I've been writing. This one is actually an update to a script i wrote a few years ago to find unused mailboxes on Exchange 2007 . This script is designed to be run from within a Remote Powershell session that is already connected to your Exchange 2010 org (or from a Exchange Online/Office365 remote powershell session).  It uses Get-Mailbox to get all the mailboxes in your org and then it uses the EWS Managed API to connect to each mailbox and makes a query of the Inbox (using a AQS query String) to get all the Email in the mailbox for the last 6 months,  then it queries for all email in the last 6 months that is still marked unread. Then it queries the Sent Email folder for how many email where sent for the last 6 months. (this would only be accurate based on the user behavior of moving messages). Its combines this with the statistics from Get-MailboxStatistics to produce a csv file that wou

EWS Managed API and Powershell How-To series Part 4 - Items Part 2

Continuing on from my last post in this how to series on Items this post is going to look at how you can go about creating, deleting, moving, copying,exporting different Items and we will also look at the important batch operations which help when you need to perform actions on multiple Items at the same time. As I have mentioned previously in this series when your dealing with Exchange Objects your dealing with Rich data-types that vary greatly eg  If you compare the properties on an Email object with that of a Task while they share a set of common properties what makes a Task a Task is its unique properties such as Percent complete, Start Time etc which have all been dutifully documented in this Exchange Protocol document. As this is the first I've mentioned this I would strongly recommend you check out the Open Specification Development Center which is a really brilliant resource for any reference information you need about using Exchange data types or EWS in general. Cre

Version 1.2 or the EWS Managed API just released

The new version of the EWS Managed API has just been released  which means you can start using the new Exchange 2010 SP2 features that have been added to the Managed API. A Quck few examples are First make sure you set the Version to SP2 eg ExchangeService service =  new  ExchangeService(ExchangeVersion.Exchange2010_SP2);   Using Password Expiration DateTime PasswordExpirDate = (DateTime)service.GetPasswordExpirationDate( "" );   Accessing the Directory Photo NameResolutionCollection ncCol = service.ResolveName( "" ,ResolveNameSearchLocation.DirectoryOnly, true );   foreach (NameResolution nc  in  ncCol) {       Byte[] dirPhoto = nc.Contact.DirectoryPhoto;   }   See a full list of the new features at

EWS Managed API and Powershell How-To series Part 3 - Items

This is Part3 in my continuing EWS Managed API and Powershell how to series, in this post im going to look at using Mailbox Items in Exchange Web Services. The single most important thing obviously within a mailbox is the content and one of Exchanges main strengths is the richness and flexibility of the content and item types that it can store and process.  So in this post im going to cover the complexities of processing the different Items that are stored in a mailbox in different way to solve various everyday problems. Items, Objects and Properties Some of the Items you might find in an Exchange Mailbox include Email, Contacts, Calendar Appointments, Meeting, Tasks and other custom Item types. The data that constitutes an Exchange Item for example the Subject of an email message is stored as one or more properties in the Exchange Mail-Store associated with that Item. Looking at the Subject example a little more deeply the underlying Property for the subject is PidTagSubject htt
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.