EWS: Hide a named folder in multiple mailboxes


Recently we’ve had a couple of requests that involved deleting or hiding mailbox folders that are created automatically either by Outlook or Lync.  Deleting such folders is usually both not supported and also not possible – they will most likely be marked as distinguished folders, which means that they can’t be deleted.  If you do manage to delete them (which can be done using some very unsupported methods), they will be recreated.

Even though the folders can’t be deleted, it may be that they can be hidden (note that this would need to be confirmed for the specific folder, as it may be that hiding a distinguished folder could have unintended consequences).

The attached application can process multiple mailboxes hiding a particular folder.  The folder must be a subfolder of the mailbox root (at the same level as the Inbox), though if necessary the code could be modified to look for other folders.  The folder is searched for by name, and if found then the property PidTagAttributeHidden is set to true, which hides the folder.  Note that you may need to restart the mail client to pick up the change (Outlook in particular seems only to read this property on start-up).

To process multiple mailboxes, you will need to grant impersonation rights to the account being used to run the application (see http://msdn.microsoft.com/en-us/library/exchange/bb204095(v=exchg.140).aspx for Exchange 2010, which also applies to 2013).  The application queries Active Directory for users with mailboxes (assuming the filter is left at default).  You can apply a scope by entering an OU in the scope box.  If you specify a name (as opposed to DN) for the OU, then a search is made for it – so long as only one OU matches the search, then that will be set as the scope.  If you enable the Debug option, then all EWS requests/responses will be logged.

 

HideFolder Screenshot

HideFolder.zip

Comments (0)

Skip to main content