根据文档, .FindAppointments() 扩展了项目的重复出现:
通过搜索此文件夹的内容并为重复约会执行重复扩展来获取约会列表
它不工作:
ExchangeService service = ExchangeServiceUtilities.CreateExchangeService(s,u);
DateTime now = DateTime.Now;
CalendarView cv = new CalendarView(now, now);
CalendarFolder cal = CalendarFolder.Bind(service,WellKnownFolderName.Calendar);
FindItemsResults<Appointment> apps = cal.FindAppointments(cv);
Trace.WriteLine(apps.TotalCount);
foreach (Appointment a in apps)
{
a.Load();
Trace.WriteLine(a.IsRecurring);
Trace.WriteLine("Checking: " + a.End.ToString() + " : " + now);
if (a.End > now)
{
Trace.WriteLine("Setting Appointment for: " + u.Id);
ScheduleAppointment(a,u);
}
}
产生以下内容:
1
True
Checking: 6/24/2013 10:00:00 PM : 6/24/2013 9:41:12 PM
Setting Appointment for: 6dd36837d202bf28b0a8cfece47fb111cd0fec04
它设置为每半小时重复一次,所以我应该看到更多...
我发现出了什么问题:事实证明,如果您的开始日期和结束日期相同,该方法中存在一个错误,导致它不会扩展约会。谢谢 M$。