Microsoft.Exchange.WebServices.Data.ServiceValidationException: FindItem 请求中不能使用 属性 RequiredAttendees
Microsoft.Exchange.WebServices.Data.ServiceValidationException: The property RequiredAttendees can't be used in FindItem requests
我正在从 EWS 日历访问约会参加者。我试过了:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End);
但我的 appointments
列表条目每个都返回空 Required/Optional 参加者字段,即使测试约会已被多个用户接受。我的假设是 PropertySet 需要包含更多 ApplicationSchema
属性,如下所示:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees);
然而,这会在 calendar.FindAppointments(cView) 上引发以下 ServiceValidationException 错误:
Microsoft.Exchange.WebServices.Data.ServiceValidationException: The property RequiredAttendees can't be used in FindItem requests.
如何解决此问题以便 appointments
包括 required/optional 名与会者?
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);
收件人是随 FindItems 操作不返回的正文的属性之一,您需要使用 GetItem 请求来获取这些属性,请参阅 https://msdn.microsoft.com/en-us/library/bb508824.aspx and https://blogs.msdn.microsoft.com/exchangedev/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services/
我正在从 EWS 日历访问约会参加者。我试过了:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End);
但我的 appointments
列表条目每个都返回空 Required/Optional 参加者字段,即使测试约会已被多个用户接受。我的假设是 PropertySet 需要包含更多 ApplicationSchema
属性,如下所示:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.RequiredAttendees,
AppointmentSchema.OptionalAttendees);
然而,这会在 calendar.FindAppointments(cView) 上引发以下 ServiceValidationException 错误:
Microsoft.Exchange.WebServices.Data.ServiceValidationException: The property RequiredAttendees can't be used in FindItem requests.
如何解决此问题以便 appointments
包括 required/optional 名与会者?
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);
收件人是随 FindItems 操作不返回的正文的属性之一,您需要使用 GetItem 请求来获取这些属性,请参阅 https://msdn.microsoft.com/en-us/library/bb508824.aspx and https://blogs.msdn.microsoft.com/exchangedev/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services/