Search EWS by topic

I am using EWS Managed API 2.0. I would like to be able to search for a calendar in exchange for an appointment topic in the future.


  • return only future appointments matching the topic = "test"
  • only return future appointments within the next 90 days.

I can get a CalendarView to return appointments for the next 90 days, but cannot figure out how to filter using SearchFilter. For best performance, I prefer not to return all appointments and then filter.

I can filter appointments by topic using ItemView and SearchFilter. However, this does not filter out appointments that have already occurred. It returns whatever matches the filter.

Ideally, it would be nice if I could use CalendarView in SearchFilter, but I get an error . Limits and sort order may not be specified for CalendarView.

FindItemsResults<Item> findResults = svc().FindItems(fId, filter, cView);


Any help would be great ... thanks!


source to share

2 answers

I understood that.

Using complex search filters, for example

        SearchFilter.SearchFilterCollection coll = new SearchFilter.SearchFilterCollection(LogicalOperator.And);            
        SearchFilter subjectFilter = new SearchFilter.ContainsSubstring(AppointmentSchema.Subject, "test");
        SearchFilter dateFilter = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, DateTime.Today);

        FindItemsResults<Item> findResults = svc().FindItems(fId, coll, view);




Beware, with complex search filters, you will not get a repeating series if the main item is outside the specified time range.

This is because the occurrences (and exceptions) in the repeating series are not actual items in the mailbox, but rather are stored internally as attachments for the repeating wizard. The ExchangeService.FindItems method does not scan the attachment table of each calendar item to find occurrences and exceptions. (Source: )

So, if you are dealing with recurring events (IMHO), better use the CalendarView and CalendarFolder.FindAppointments method, which does re-expansion for recurring appointments.

The downside is that it doesn't support search filters ... So you have to filter objects separately.

Does anyone have a better solution? Any help would be greatly appreciated. Thank.



All Articles