2013-03-21 55 views
3

我尝试使用某种范围为[Start]过滤器的Outlook AppointmentItem给人奇怪的结果

var calendar = outlookApplication.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar); 

if (calendar == null || calendar.Items == null) 
{ 
    return null; 
} 

DateTime appointmentStart = new DateTime(2013, 03, 25, 10, 0 ,0); 

string filter = string.Format("[Start] > '{0}' And [Start] < '{1}'", appointmentStart.AddMinutes(-1).ToString("g"), appointmentStart.AddMinutes(+1).ToString("g")); 
var calendarItems = calendar.Items.Restrict(filter); 

我在Outlook10:00:0025.03.2013AppointemtItem。因此,正在等待得到这个AppointmentItem为calendar.Items.Restrict(filter);

,但结果我成了2个AppointmenItems:

  • 正确的

  • ,也从一个05.04.2012 - 从05 2012年4月(不2013)有开始10:30:00和结束10:40:00

我不明白w帽子有05.04.2012 10:30:00 - 10:40:00与

过滤> 25.03.2013 09:59和< 25.03.2013 10:01?

回答

0

从05.04.2012开始AppointmentItem是经常性的。

我不知道为什么在calendar.Items.Restrict(filter)之后显示,但是我的解决方案是检查IsRecurring属性。