If you want to search for emails that have been protected using AD Rights Managed Service using EWS there are a few challenges. How RMS works with Email it is documented in the following Exchange Protocol document https://msdn.microsoft.com/en-us/library/cc463909(v=exchg.80).aspx . The important part when it comes to searching is PidNameContentClass property https://msdn.microsoft.com/en-us/library/office/cc839681.aspx which on RMS messages gets set to rpmsg.message. So to search for this Internet Header you can use a SearchFilter like the following to define the ExtendProperty to search folder $contentclassIh = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition( [Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet] :: InternetHeaders, "content-class" , [Microsoft.Exchange.WebServices.Data.MapiPropertyType] :: String) ; $sfItemSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo( $contentclassIh , ...
Pushing the Envelope in Messaging and Office 365 Development