获取所有用户的所有约会或获得一个房间的所有约会

问题描述:

我想获得给定具体日期的所有约会。我检查API,似乎只能得到特定用户的委任吗?获取所有用户的所有约会或获得一个房间的所有约会

DateTime startDate = DateTime.Now; 
      DateTime endDate = startDate.AddDays(365); 
      const int NUM_APPTS = 5; 

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

      // Retrieve a collection of appointments by using the calendar view. 
      FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView); 

      Console.WriteLine("\nThe first " + NUM_APPTS + " appointments on your calendar from " + startDate.Date.ToShortDateString() + 
           " to " + endDate.Date.ToShortDateString() + " are: \n"); 

      foreach (Appointment a in appointments) 
      { 
       Console.Write("Subject: " + a.Subject.ToString() + " "); 
       Console.Write("Start: " + a.Start.ToString() + " "); 
       Console.Write("End: " + a.End.ToString()); 
       Console.WriteLine(); 
      } 

我希望可以得到所有约会或获得特定房间的所有约会,然后我可以通过代码提取信息。谢谢!

使用EWS,findItems操作是针对每个邮箱文件夹完成的,所以如果您想查询其他日历,则需要执行多项操作。在你的代码,如果你想查询室邮箱具有[email protected]您需要使用FolderId超负荷如

FolderId cfFolderId = new FolderId(WellKnownFolderName.Calendar, "[email protected]"); 
CalendarFolder calendar = CalendarFolder.Bind(service, cfFolderId, new PropertySet()); 

干杯 格伦

主SMTP地址