0

I was trying to filter emails based on their attachments. So i am filtering based on the attachment name to be more precise. Filtering with AQS ("attachments: picture.jpg") works fine and i get the right results. But when i use SearchFilters i get no results. I am using the following command:

var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Attachments, "picture.jpg");

I even used the explicit filter parameters but still get no results.

var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Attachments,"picture.jpg", ContainmentMode.Substring, ComparisonMode.IgnoreCase);

I use Exchange Server 2016/2019.

yoxhall
  • 66
  • 1
  • 7
  • 1
    You can't use a contains query on a collection property in EWS so that won't work, the only way of querying based on attachment name would be use an AQS query string and then filter at the client side what you don't want. – Glen Scales Jan 26 '23 at 21:04

0 Answers0