3

Я обращаюсь к участникам встречи из календаря EWS. Я пробовал:Microsoft.Exchange.WebServices.Data.ServiceValidationException: свойство RequiredAttendees не может использоваться в запросах FindItem.

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); 

ответ

4

Получателями являются одним из свойств вместе с телом, не вернулся с работы 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/

Смежные вопросы