Sometimes particular attachments can create different issues for a number of different reasons so you might find you want to get rid of all those attachments without removing the messages they are attached to. If you find yourself in this situation then this is the sample for you. Firstly to find the attachments of a specific type we use the following AQS query System.Message.AttachmentContents:.pdf This acts as a first level filter but it will give a few false positives so a second client level check of the actual Attachment file name is needed. foreach ( $Attachment in $Item .Attachments) { if ( $Attachment -is [Microsoft.Exchange.WebServices.Data.FileAttachment]){ if ( $Attachment .Name.Contains( ".pdf" )){ ...
Pushing the Envelope in Messaging and Office 365 Development