获取所有用户的所有约会或获取一个房间的所有约会 [英] Get all appointments of all users or get all appointments of one room

查看:100
本文介绍了获取所有用户的所有约会或获取一个房间的所有约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让所有约会都有一个特定的日期.我检查了API,看来只能为特定用户获得约会吗?

I would like to get all appointments giving a specific date peroid. I check the API, it seems only can get appointnments for a specific user?

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

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

I hope can get all appointments or get all appointments for a specific room, then I can extract info by code. Thanks!

推荐答案

使用EWS,findItems操作是针对每个邮箱文件夹完成的,因此,如果要查询其他日历,则需要执行多项操作.在代码中,如果您要查询具有主要SMTP地址为room@domain.com的会议室邮箱,则需要使用FolderId重载,例如

With EWS the findItems operation is done per Mailbox Folder so if you want query other calendars you need to do multiple operations. In your code if you wanted to query the Room Mailbox that had a Primary SMTP Address of room@domain.com you need to use the FolderId overload eg

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

欢呼 格伦

这篇关于获取所有用户的所有约会或获取一个房间的所有约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆