Outlook 不返回预约重复
我正在使用 VSTO for Outlook 2007。
当访问日历中的约会时,我想查看所有重复事件 - 而不仅仅是系列主项目。
我的代码如下,
var calendarFolder = Globals.TestAddin.Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
var outlookCalendarItems = calendarFolder.Items;
outlookCalendarItems.IncludeRecurrences = includeRecurring;
var appointmentItems = outlookCalendarItems.Cast<AppointmentItem>();
foreach ( var appointmentItem in appointmentItems )
{
var item = appointmentItem;
this.LogBox.AppendText(item.Subject);
}
它显示所有正常项目,所有系列主项目,但没有计算的系列约会。
示例:它显示我母亲 1949 年 10 月的生日作为重复项目,但她的生日没有在 1950 年、1951 年...等。
我做错了什么?
感谢您的想法!
萨沙
I'm playing around with VSTO for Outlook 2007.
When accessing appointments in calendar, I'd like to see all recurrences - not only the series-main item.
My code is as following
var calendarFolder = Globals.TestAddin.Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
var outlookCalendarItems = calendarFolder.Items;
outlookCalendarItems.IncludeRecurrences = includeRecurring;
var appointmentItems = outlookCalendarItems.Cast<AppointmentItem>();
foreach ( var appointmentItem in appointmentItems )
{
var item = appointmentItem;
this.LogBox.AppendText(item.Subject);
}
It shows all normal items, all series-master items but no calculated series appointments.
Example: it shows my mothers birthday in october 1949 as an recurring item, but none of her following birthdays in 1950, 1951... etc.
What am I doing wrong?
Thanks for ideas!
Sascha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加一行就可以了:
Adding one single line did it:
当包含日期之间没有“查找”的重复时,此代码有可能成为永恒循环。
这是因为它将为它能找到的每个事件创建一个“appointmentItem”。如果存在未设置重复结束日期的重复日历项目,则此循环将继续为每次出现(永远)创建“约会项目”。
要解决此问题,您需要限制找到的结果,请参阅下面如何限制结果。:
http://msdn.microsoft.com/en-us/library/office/dd469461(v=office.12).aspx
When including recurrences without a 'Find' between dates, this code has potential to become an eternal loop.
This is because it will create an 'appointmentItem' for each occurrence it can find. If there are recurring calendar items which have no recurrence end date set, this loop will continue to create 'appointmentItem's for every occurrence (forever).
To get around this, you need to limit the results you find, see below how to limit results.:
http://msdn.microsoft.com/en-us/library/office/dd469461(v=office.12).aspx