我正在從EWS日曆訪問預約出席者。我想:Microsoft.Exchange.WebServices.Data.ServiceValidationException:無法在FindItem請求中使用屬性RequiredAttendees
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
但我appointments
列表中的每個條目返回null必需/可選與會者領域,即使測試的任命受到了許多用戶所接受。我的假設是,屬性集需要包括像這樣更ApplicationSchema
性質:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees);
但是,這將引發對calendar.FindAppointments以下ServiceValidationException錯誤(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);