Skip to main content

Posts

Showing posts from April, 2016

EWS Bascis : Accessing Public Folders and Public Folder Content

As well as Mailboxes and Archives, Public Folders are another place you may want to use EWS to enumerate Items to do some enhanced reporting. Building on the Enumerate script from the last two post, this post will cover how to modify this script to enable access Public Folder and Public Folder Items. EWS Changes To change the Mailbox code we have to access public folders requires one big change in the Mailbox script we have the line $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId( [Microsoft.Exchange.WebServices.Data.WellKnownFolderName] :: MsgFolderRoot, $SmtpAddress ) in the FolderIdFromPath function. To access a Public folder we need to change this to $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId( [Microsoft.Exchange.WebServices.Data.WellKnownFolderName] :: PublicFoldersRoot) And that's pretty much it apart from renaming the function to PublicFolderIdFromPath this is all you have to do. One thing you can't do w

EWS Basics : Reporting on the Age of Items in a Folder

One of the more common questions I get is around some of the EWS Item Age scripts I've written in the past. If we take the script I introduced in the first Basics post with some easy modifications we can turn this script that already enumerates all the Items in a folder into a script that will report on age of the Items in a folder. So in this post I'm going to try to explain a little better the changes that you would need to make. EWS Changes The EWS changes that need to be made to the basics script are to the Propertyset that is used in the FindItems Operation. A PropertySet in EWS basically tells Exchange which properties you want to be returned. So to make this script as efficient as possible we want to restrict Exchange to just returning the Size and DateTime the messages where received or created. So these are the only changes that are needed for the EWS side $ivItemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(1000) $ItemPropset = new-object
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.