Skip to main content

Posts

Showing posts from April, 2011

Using EWS to calculate the age of Items and affect of archive and retention policies in Exchange 2010

While there are plenty of cmdlets within the Exchange Management Shell to calculate the Mailbox and Folder sizes and even Item sizes within public folders there is no cmdlets you can currently use to look at the age of the content within a mailbox to see how old it is and what affect an retention policy may have for example you may want to know how much data will be shifted to an archive store(Search-Mailbox kind of does it but...). To look at Mailbox Content the EWS Managed API provides a easy entry point and the flexibility to do this . On Exchange 2010 to scan for content between a particular date range using a Content Index query via Exchange Search is the quickest and most efficient way of querying this data. The EWS Managed API allows you to perform a CI search via Exchange Search using the AQS querystring overload parameter of the FindItems method see http://msdn.microsoft.com/en-us/library/ee693615%28v=exchg.140%29.aspx . With AQS the operator .. can be used to search between

Displaying the OOF log in a mailbox using Exchange Web Services and Powershell

On a Exchange 2007 and 2010 when changes are made to the Out of Office setting these changes are logged into an Item sitting in the Non_IPM_Subtree folder of a mailbox which has a message class of IPM.Microsoft.OOF.Log . The log of changes is written to the body of this message and can be useful if for any reason you need a historical record of the oof setting for a particular mailbox. For instance if someone set an inappropriate OOF message and you need some evidence of this. You could also sequence this data to get picture over a certain time period of what users had their oof set and for how long it was enabled and did it say anything useful. I've put together a script to show how to get at this log using the EWS Managed API and powershell and I've also included a parser to parse the log entries into an object to make it easier to export this data to csv or email etc. I've put a download of this script here the script itself looks like $MailboxName = "user@domain&

Reading custom MAPI properties in a Transport Agent

In Exchange 2007 and 2010 all mail that is sent and received must transit its way through a Hub server where if your a developer you can create a transport agent to perform additional tasks on those messages before the are passed out of your org or into a mailbox. Sometimes these tasks may involve custom mapi properties that you may have created by using customized forms in Outlook or OWA or possibly a custom EWS application. When it comes to accessing these custom properties in a Transport Agent it involves using the TNEFReader in a transport agent to parse TNEF part of a message. TNEF for those uninitiated stands for Transport Neutral Encapsulation Format which is a serialization format that Exchange uses to send the Mapi properties of a Item via email there is a protocol document that covers this http://msdn.microsoft.com/en-us/library/cc425498%28v=EXCHG.80%29.aspx . What the TNEFReader does is allows a Transport Agent to parse all the different property structures and data-types c
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.