如何从特定日历(特定日期)获取所有项目.让我们说比如每周一晚上我有一个带有重复项目的日历.当我请求所有这样的项目时:
CalendarItems = CalendarFolder.Items;
CalendarItems.IncludeRecurrences = true;
Run Code Online (Sandbox Code Playgroud)
我只买1件......
是否有一种简单的方法可以从日历中获取所有项目(主要项目+派生项目)?在我的具体情况下,可以设置一个日期限制,但只是为了获得所有项目(我的经常性项目本身是时间限制的)很酷.
我正在使用Microsoft Outlook 12对象库(Microsoft.Office.Interop.Outlook).
我试图在周范围内获得所有约会,但重复出现的约会没有出现.
这是代码:
var outlook = new Microsoft.Office.Interop.Outlook.Application();
var calendar = outlook.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
calendar.Items.IncludeRecurrences = true;
string filter = String.Format("[Start] >= {0} And [End] < {1}",
DateTime.Now.Date.ToString("ddddd h:nn AMPM"),
DateTime.Now.Date.AddDays(5).ToString("ddddd h:nn AMPM"));
Outlook.AppointmentItem appointment;
foreach (var item in calendar.Items.Restrict(filter))
{
appointment = item as Outlook.AppointmentItem;
if (appointment != null)
{
MessageBox.Show(appointment.Start.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
如何获取Outlook中显示的所有定期约会一周?