Outlook 不返回预约重复

发布于 2024-11-18 09:10:39 字数 693 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经大条 2024-11-25 09:10:39

添加一行就可以了:

outlookCalendarItems.Sort("[Start]");

Adding one single line did it:

outlookCalendarItems.Sort("[Start]");
離人涙 2024-11-25 09:10:39

当包含日期之间没有“查找”的重复时,此代码有可能成为永恒循环。

这是因为它将为它能找到的每个事件创建一个“appointmentItem”。如果存在未设置重复结束日期的重复日历项目,则此循环将继续为每次出现(永远)创建“约会项目”。

要解决此问题,您需要限制找到的结果,请参阅下面如何限制结果。:

http://msdn.microsoft.com/en-us/library/office/dd469461(v=office.12).aspx

Set currentAppointment = myAppointments.Find("[Start] >= """ & _
        tdystart & """ and [Start] <= """ & tdyend & """")

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

Set currentAppointment = myAppointments.Find("[Start] >= """ & _
        tdystart & """ and [Start] <= """ & tdyend & """")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文