Outlook 2010:如何获取所有约会的列表,包括重复约会
我试图列出默认文件夹中的所有约会,如下所示:
Outlook.MAPIFolder calendarFolder = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.Items outlookCalendarItems = calendarFolder.Items;
outlookCalendarItems.IncludeRecurrences = true;
List<Outlook.AppointmentItem> lst = new List<Outlook.AppointmentItem>();
foreach (Outlook.AppointmentItem item in outlookCalendarItems)
{
lst.Add(item);
}
这列出了所有约会,除了定期约会 - 它只列出了第一次出现。有没有办法将所有重复添加到此列表中?
I was trying to list all appointments in the default folder, like so:
Outlook.MAPIFolder calendarFolder = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.Items outlookCalendarItems = calendarFolder.Items;
outlookCalendarItems.IncludeRecurrences = true;
List<Outlook.AppointmentItem> lst = new List<Outlook.AppointmentItem>();
foreach (Outlook.AppointmentItem item in outlookCalendarItems)
{
lst.Add(item);
}
This lists all the appointments, except the recurring appointments - it only lists the first ocurrence. Is there a way to add all recurrences to this list?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用
AppointmentItem.GetRecurrancePattern
方法(和RecurrencePattern
类型) 离开约会项目,然后您可以迭代它们。获取单个事件的示例可以此处找到:
Try using the
AppointmentItem.GetRecurrancePattern
method (andRecurrencePattern
type) off the appointment item, then you can iterate over them.An example of getting a single occurrence can be found here:
如果按开始时间排序,则可以使用 IncludeRecurrences 属性获取所有约会项目。需要注意的是,如果您有没有结束的重复约会,您将陷入无限循环,因此请务必测试结束日期。
请参阅:https://msdn.microsoft.com/ en-us/library/bb220097(v=office.12).aspx
If you sort by start time, you can then use the IncludeRecurrences property to get all appointment items. One word of caution - if you have recurring appointments that don't have an end, you'll get an infinite loop - so be sure and test for an end date.
See: https://msdn.microsoft.com/en-us/library/bb220097(v=office.12).aspx