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
1
votes
1 Answers
0
votes
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: