Filter Appointments from Exchange Server

Filtering Appointments with EWS

The IEWSClient provides the facility to filter appointments from the Exchange server using the ExchangeQueryBuilder. Appointments can be filtered based on:

  • Dates
  • Recurrences

Filtering Appointments by Dates

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, username, password, domain);
DateTime startTime = new DateTime(2017,09, 15);
DateTime endTime = new DateTime(2017, 10, 10);
ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
builder.Appointment.Start.Since(startTime);
builder.Appointment.End.BeforeOrEqual(endTime);
MailQuery query = builder.GetQuery();
Appointment[] appointments = client.ListAppointments(query);

Filtering Appointments by Recurring Events

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
builder = new ExchangeQueryBuilder();
builder.Appointment.IsRecurring.Equals(false);
query = builder.GetQuery();
appointments = client.ListAppointments(query);