Outlook Filter Items - Get all recurring appointments in a week range

前端 未结 1 719
面向向阳花
面向向阳花 2021-01-06 18:20

I\'m trying to get all appointments in outlook in week range, but reoccurring appointments are not showing up.

Here is the code:

    var outlook = ne         


        
相关标签:
1条回答
  • 2021-01-06 19:04

    You have to use recurrence pattern Put this inside your loop:

         if (item.IsRecurring)
            {
                Microsoft.Office.Interop.Outlook.RecurrencePattern rp = item.GetRecurrencePattern();
                DateTime first = new DateTime(2011, 11, 7, item.Start.Hour, item.Start.Minute, 0);
                DateTime last = new DateTime(2011, 12, 1);
                Microsoft.Office.Interop.Outlook.AppointmentItem recur = null;
    
    
    
                for (DateTime cur = first; cur <= last; cur = cur.AddDays(1))
                {
                        recur = rp.GetOccurrence(cur);
                        Console.WriteLine(cur.ToLongDateString());
                }
            }
    

    see this for more info

    0 讨论(0)
提交回复
热议问题