Search code examples
c#exchangewebservicesexchange-server-2010ews-managed-apiappointment

Exchange Web Services Managed API: How can I perform Recurrence Expansion through the FindItem Method?


We are currently working on creating a sync service between our product and Exchange using Exchange Web Services Managed API. Specifically we want to sync (on a time schedule) specific Appointments back and forth on a users calender. As part of the sync, we don't necessarily want to sync ALL appointments, but have built up some complex SearchFilters to return only the appointments we want. Our problem is that in order to use the SearchFilters, we need to use the ExchangeService.FindItems method, but this method only returns the Master Recurrence of recurring events. Our other option is to use ExchangeService.FindAppointment, this will do the Recurrence Expansion for us, but has the new problem that we can only limit the result appointments using a start and end date. Looking at how the ExchangeService.FindAppointment is implemented, we can see that it is implemented using the FindItems method, which leads me to believe that I should be able to tell the ExchangeService.FindItems method to do a recurrence expansion.

How can I get a list of expanded appointments from exchange using a complex SearchFilter?


Solution

  • Just found this on MSDN: http://msdn.microsoft.com/en-us/library/hh148195(v=exchg.140).aspx

    Considerations for searching calendar appointments

    Calendar appointments are a special case for searches. Some calendar appointments, such as recurring appointments, can have exceptions and deleted occurrences. To ensure that the Exchange server expands recurring appointments when searching a calendar folder, you need to use calendar paging. When you use calendar paging, however, you can’t use any other search restrictions. This means that if, for example, you want to display all of the calendar appointments this month for a particular organizer, you can't create a search filter that is based on the organizer. Instead, you can use the CalendarView class to query for all appointments in the month and then filter the appointments on the client side based on the organizer. The following example shows how to use a calendar view to search for appointments in a calendar.