如何使用C#按属性值限制所有Outlook预约(包括重复)

时间:2016-02-06 12:32:24

标签: c# outlook outlook-addin

如何使用C#按属性值限制所有Outlook约会(包括重复)。我用 filter =“@ SQL =(http://schemas.microsoft.com/mapi/string/ {00020329-0000-0000-C000-000000000046} / TestName IS NOT NULL)”(其中TestName - 属性名称)并设置calendarItems.IncludeRecurrences = true;但我只得到简单的约会结果

1 个答案:

答案 0 :(得分:0)

要从符合预定义条件的文件夹中检索所有Outlook约会项目,您需要按升序sort项目并将IncludeRecurrences设置为true。如果在使用Restrict方法之前不这样做,则不会捕获周期性约会。

    item = resultItems.GetFirst();
    do
    {
       if (item != null)
       {
           if (item is Outlook._AppointmentItem)
           {
               counter++;
               appItem = item as Outlook._AppointmentItem;
               strBuilder.AppendLine("#" + counter.ToString() +
                                     "\tStart: " + appItem.Start.ToString() +
                                     "\tSubject: " + appItem.Subject +
                                     "\tLocation: " + appItem.Location);
           }
           Marshal.ReleaseComObject(item);
           item = resultItems.GetNext();
       }
   }
   while (item != null);

您可能会发现以下文章有用:

相关问题