I am using EWS to upgrade an application that used WebDAV to query an Exchange Server 2003 mailbox, the new version will work with Exchange Server 2010 SP2.
I want to exclude email items that have a subject that includes these search terms: "FATS;Assignment;Sandbox: Assignment"
I looked at MSDN Library: Searching for items in a mailbox by using the EWS Managed API and found out how to filter the recipients, and that the emails have attachments, but now I need to go a step further and only read emails that don't have the subjects above (4 different string exclusions)
here is the code I tried:
searchFilterCollection.Add(new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false)));
searchFilterCollection.Add(new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.HasAttachments, true)));
searchFilterCollection.Add(new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.ContainsSubstring(EmailMessageSchema.Subject, "FATS;Assignment;Sandbox: Assignment")));
but I know (the last item) will only find items that contain those terms, how can I exclude those terms using a SearchFilter please?