我正在访问EWS日历中的约会与会者。我试过了:
cView.PropertySet = new PropertySet(AppointmentSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End);
但我的appointments
列表条目每个都返回null必需/可选参加者字段,即使多个用户已接受测试约会。我的假设是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:属性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);
答案 0 :(得分:6)
收件人是属性之一以及未通过FindItems操作返回的正文,您需要使用GetItem请求来获取这些属性,请参阅https://msdn.microsoft.com/en-us/library/bb508824.aspx和https://blogs.msdn.microsoft.com/exchangedev/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services/