If I do this:
_calendar = (CalendarFolder)Folder.Bind(_service, WellKnownFolderName.Calendar);
var findResults = _calendar.FindAppointments(
new CalendarVie
You can use ItemView
and SearchFilter
to query appointments:
var itemView = new ItemView(100, 0);
itemView.PropertySet = new PropertySet(BasePropertySet.IdOnly,
ItemSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
var filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And,
new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "IPM.Appointment"),
new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, startDate),
new SearchFilter.IsLessThan(AppointmentSchema.Start, endDate));
bool moreAvailable = true;
while (moreAvailable)
{
var result = _service.FindItems(WellKnownFolderName.Calendar, filter, itemView);
foreach (var appointment in result.OfType())
{
DateTime start = appointment.Start;
DateTime end = appointment.End;
string subject = appointment.Subject;
// ...
}
itemView.Offset += itemView.PageSize;
moreAvailable = result.MoreAvailable;
}