C# 日历约会捕获
我试图在 C# 代码中从 Outlook 捕获日历事件的条目,但在捕获重复记录时遇到问题。即使我做了一周/一个月的重复记录,它们似乎每天都会出现。关于如何做到这一点有什么建议吗?
以下是我正在做的事情的摘要:
1. 获取 Outlook 中存在的所有文件夹并检查当前文件夹类型是否为 Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem。
2. 一旦我有了日历项目的文件夹,我就创建一个过滤器,使用以下语句仅获取特定持续时间的约会:
string filter = "[Start] >= '" + start.ToString("g") + "' AND [Start] < '" + end.ToString("g") + "'";
Microsoft.Office.Interop.Outlook.Items calendarItems =folder.Items.Restrict(filter);
3 然后,我从上面的 calendarItems 列表中获取各个约会。
I am trying to capture the entries for calendar events from Outlook in my C# code and I am having trouble in capturing the recurring records. They seem to show up everyday even though if I make a recurring record for a week/month. Any suggestions on how it can be done?
Here is a summary of what I am doing:
1. Fetching all folders present in Outlook and checking if the current folder type is Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem.
2. Once I have the folder for calendar Items, I create a filter to get appointments only for a specific duration using the following statements:
string filter = "[Start] >= '" + start.ToString("g") + "' AND [Start] < '" + end.ToString("g") + "'";
Microsoft.Office.Interop.Outlook.Items calendarItems = folder.Items.Restrict(filter);
3 Then I fetch individual appointments from the above calendarItems list.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要在项目上设置 IncludeRecurrences。有关更多详细信息和示例代码,请参阅 MSDN: IncludeRecurrences。
You want to set IncludeRecurrences on the Items. See MSDN: IncludeRecurrences for more details and sample code.