Servicios web de Exchange: filtros de búsqueda más complejos

In a previous project where I used EWS, my search criteria was much simpler: find emails with "xxx" in the Subject.

I'm now building this code into a more multi-purpose application; I will be monitoring various mailboxes for various criteria, for example:

Find all mail items where the recipient is "", AND subject contains "xxx" AND (body contains "yyy" OR body contains "zzz")

However, using a SearchFilterCollection, although I can add multiple SearchFilters, I don't see how to apply different logical operators... there seems to be one logical operator per SearchFilterCollection:

SearchFilterCollection sfc = new SearchFilterCollection(LogicalOperator.Or, new SearchFilter.ContainsSubstring(ItemSchema.Subject, "Test"));

I suppose one solution would be to find a superset of the desired mail items, and then filter them more accurately later, when they are being processed. But I was wondering if there is a better way of filtering at the start, using SearchFilters or any other means?

preguntado el 02 de febrero de 12 a las 11:02

@Bolu - looking promising - you should post this as an answer.... -

lol - better, but this is still a comment. I can't still accept it as an answer. ;) -

My answer was deleted&converted by someone to the comment above. whatever, I'm fine as long as you know how to do it now. -

1 Respuestas

You could build-up your complex Searchfilter using SearchFilter.SearchFilterCollection (LogicalOperator, SearchFilter[])

Comprobar: HOW TO: Build a complex search using SearchFilter and SearchFilterCollection in EWS Managed API 1.0

Respondido 06 Feb 12, 20:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.