Я получаю доступ к участникам встречи из календаря EWS. Я пытался:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End);
Но каждая из моих записей списка appointments
возвращала нулевые поля «Обязательные/необязательные участники», даже несмотря на то, что тестовые встречи были приняты несколькими пользователями. Я предполагаю, что PropertySet должен включать больше свойств ApplicationSchema
, например:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees);
Однако это вызывает следующую ошибку ServiceValidationException в calendar.FindAppointments(cView):
Microsoft.Exchange.WebServices.Data.ServiceValidationException: свойство RequiredAttendees нельзя использовать в запросах FindItem.
Как исправить это, чтобы appointments
включало обязательных/необязательных участников?
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials(emailAddress, emailPassword);
// Initialize values for the start and end times, and the number of appointments to retrieve.
DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddYears(1);
const int NUM_APPTS = 4;
// Initialize the calendar folder object with only the folder ID.
CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
// Set the start and end time and number of appointments to retrieve.
CalendarView cView = new CalendarView(startDate, endDate, NUM_APPTS);
// Limit the properties returned to the appointment's subject, start time, and end time.
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees);
// Retrieve a collection of appointments by using the calendar view.
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);