简体   繁体   中英

How to restrict all outlook appointments (including recurring) by property value using C#

How to restrict all outlook appointments (including recurring) by property value using C#. I use filter = "@SQL=( http://schemas.microsoft.com/mapi/string/ {00020329-0000-0000-C000-000000000046}/TestName IS NOT NULL)" (where TestName - property name) and set calendarItems.IncludeRecurrences = true; but I get only simple appointments results

To retrieve all Outlook appointment items from the folder that meets the predefined condition, you need to sort the items in ascending order and set the IncludeRecurrences to true. You will not catch recurrent appointments if you don't do this before using the Restrict method.

    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);

You may find the following articles helpful:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM