liaoyungchun |
2017-07-13 09:41 |
/// <summary> /// 获取用户在某段时间内的所有会议。最长时间间隔为42天。 /// </summary> /// <param name="startDate">要查询的开始时间。</param> /// <param name="endDate">要查询的结束时间</param> /// <param name="mailbox">要查询的邮箱日历,如果查询当前登录的用户的日历,可不填。</param> /// <returns>返回一个会议列表。列表对象不包含详细信息(如接受拒绝状态等),需使用<see cref="GetMeetingStatus"/> 方法获取。</returns> public List<Appointment> GetMeetings(DateTime startDate, DateTime endDate, string mailbox = null) { CalendarFolder calendar = null;
if (mailbox == null) { calendar = CalendarFolder.Bind(Service, WellKnownFolderName.Calendar); } else { FolderId folderid = new FolderId(WellKnownFolderName.Calendar, mailbox); calendar = CalendarFolder.Bind(Service, folderid); }
// Set the start and end time and number of appointments to retrieve. CalendarView cView = new CalendarView(startDate, endDate);
// Limit the properties returned to the appointment's subject, start time, and end time. cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.LastModifiedTime, AppointmentSchema.IsMeeting, AppointmentSchema.Start, AppointmentSchema.End);
// Retrieve a collection of appointments by using the calendar view. FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView); return appointments.Where(m => m.IsMeeting).ToList(); } |
|