Introduction

Current version: 1.0.3

This script uses EWS to access a mailbox and process a list of items specified by EntryId.  While it can be used to simply delete items specified by EntryId, it is intended to be used in conjunction with the Check-NamedProps function - it can take the output from that script and then process the items to remove named properties from them.

Description

This script uses EWS to access a given mailbox to remove named properties from items, or to delete the items.  Please see this blog post for its intended use and further information.

Parameters

-Mailbox The mailbox to be processed.  This is only required if it is not specified in the EntryIds file.
-Archive Must be specified if the items are in the archive mailbox (otherwise primary mailbox is assumed).
-EntryIds This can be a list of EntryIds, or more usually would be the file from which the information is retrieved (e.g. the output from Check-NamedProps)
-DeleteItems If this switch is specified, items are deleted (otherwise they won't be).  When dealing with named properties, this switch is not recommended.
-Batch This only applies if -DeleteItems is set, and will batch the delete requests (which significantly speeds up the process)
-Credentials Credentials used to access the mailbox (note that the mailbox is accessed using ApplicationImpersonation, so the specified account must have that role on the target mailbox)
-DoNotImpersonate By default, the script assumes that ApplicationImpersonation is being used to access the mailbox.  Use this switch if not (i.e. the authenticating user is the mailbox owner, or has FullAccess rights to the mailbox).
-EwsUrl The EWS Url (if not specified, AutoDiscover will be used to try and determine this).
-EwsManagedApiPath The path to the EWS Managed API (not usually required as the script will search common paths).
-IgnoreSSLCertificate Ignores invalid SSL certificates. Use with care - should only be needed in a lab environment.
-AllowInsecuredRedirection Applies to AutoDiscover, and will allow insecure redirection during that process.
-LogFile Activity will be logged to this file (it is recommended that you use this).
-TraceFile This logs the EWS conversation, and should only be needed if debugging.