EWS-managed: Fetch required and optional attendees

2019-02-24 19:41发布

问题:

As far as I am now, I know how to fetch appointments from exchange server, BUT as soon as I want to see the required and optional attendees, these fields are empty ... I checked the appointment trice and there is an attendee, except me. Do I have to config Outlook differently or do I miss something?

            List<Appointment> listOfAppointments = new List<Appointment>();

        CalendarFolder cfolder = CalendarFolder.Bind(MyService, WellKnownFolderName.Calendar);
        CalendarView cview = new CalendarView(from.ToUniversalTime(), to.ToUniversalTime());
        cview.PropertySet = new PropertySet(ItemSchema.Subject);
        cview.PropertySet.Add(AppointmentSchema.Start);
        cview.PropertySet.Add(AppointmentSchema.End);
        cview.PropertySet.Add(AppointmentSchema.Location);
        cview.PropertySet.Add(AppointmentSchema.ICalUid);
        cview.PropertySet.Add(AppointmentSchema.Organizer);
        cview.PropertySet.Add(AppointmentSchema.IsAllDayEvent);
        cview.PropertySet.Add(AppointmentSchema.DateTimeCreated);

        FindItemsResults<Appointment> result = cfolder.FindAppointments(cview);

thats how I fetch the appointments, as I figured from exceptions and trail and error, I don't need to ask exchange for attendees... but maybe I am missing something.

回答1:

The FindAppointments operation do not return the attendees of meetings. Instead, specify a propertyset of PropertySet.IdOnly to get only the ids of the items. Then, use the ExchangeService.LoadPropertiesForItems to perform a batch load of the properties you need.