【问题标题】:Get all appointments of all users or get all appointments of one room获取所有用户的所有约会或获取一个房间的所有约会
【发布时间】:2014-11-25 12:48:02
【问题描述】:

我想获得所有指定日期的约会。我检查了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();
            }

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

【问题讨论】:

    标签: exchangewebservices


    【解决方案1】:

    使用 EWS,findItems 操作是按邮箱文件夹完成的,因此如果您想查询其他日历,则需要执行多个操作。在您的代码中,如果您想查询主 SMTP 地址为 room@domain.com 的房间邮箱,您需要使用 FolderId 重载,例如

    FolderId cfFolderId = new FolderId(WellKnownFolderName.Calendar, "Room@doman.com");
    CalendarFolder calendar = CalendarFolder.Bind(service, cfFolderId, new PropertySet());
    

    干杯 格伦

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-30
      • 1970-01-01
      • 2021-05-24
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      • 2011-12-24
      相关资源
      最近更新 更多