Can't Retrieve Resources (rooms) from Exchange

2019-04-28 17:27发布

问题:

I'm stumped. I'm using Exchange Web Services to retrieve calendar information from both my local and other calendars in my company, but the ".Resources" are always empty. We use Resources to store conference room information. Interestingly even ".RequiredAttendees" is empty, but I can retrieve values from the ".DisplayTo" and ".DisplayCc" without issue. Any suggestions? I have included a cope snippet below for reference.

  CalendarView calendarView = new CalendarView(startDate, endDate);
  Mailbox mailbox = new Mailbox(mailboxSMTP);
  FolderId calendarFolder = new FolderId(WellKnownFolderName.Calendar, mailbox);
  FindItemsResults<Appointment> findResults = service.FindAppointments(calendarFolder, calendarView);

  foreach (Appointment appointment in findResults.Items)
  {// foreach 1
      ...

Thanks, Greg

回答1:

EWS may not request the Resources property by default, but you should be able to specifically request it by adding it to the PropertySet before calling FindAppointments.

calendarView.PropertySet.Add(AppointmentSchema.Resources);