I need to retrieve calendar information by invoking the Exchange Web Service in BPOS. I'm using a CalendarView
with a PropertySet
to retrieve as little data as possible. However, property sets seems to be limited. I need the EmailAddress
of the one who made the calendar appointment so I thought I could use the AppointmentSchema.Organizer
in the PropertySet
.
When fetching a whole appointment I can get the e-mail through appt.Organizer.EmailAddress
. But with the code below the Organizer.EmailAddress
is always null. I've enabled the trace and checked it and only the Organizer.Name
property is sent, nothing else. Does anyone have a solution on how to get the EmailAddress
when using a PropertySet
?
CalendarView view = new CalendarView(dtFrom, dtTo);
view.PropertySet = new PropertySet(ItemSchema.Subject);
view.PropertySet.Add(ItemSchema.Id);
view.PropertySet.Add(AppointmentSchema.Start);
view.PropertySet.Add(AppointmentSchema.End);
view.PropertySet.Add(AppointmentSchema.Organizer); // This should contain EmailAddress but it doesn't
Mailbox mailbox = new Mailbox("[email protected]");
FolderId id = new FolderId(WellKnownFolderName.Calendar, mailbox);
CalendarFolder folder = CalendarFolder.Bind(service, id);
FindItemsResults<Appointment> findResults = folder.FindAppointments(view);
This should work (does for me):
service.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(start, end)).Where(s => DateTime.Now < s.Start);
service.LoadPropertiesForItems(appointments, PropertySet.FirstClassProperties);