GetOccurrence if there is No End Date. RRS feed

  • Question

  • I have appointment item which is recurring. When some user set No end date is true,I'll change pattern end date as end of currant year and get how many time that item is recurring. But I am getting error "You changed one of the recurrences of this item, and this instance no longer exists. Close any open items and try again."

    Here is my code. Can some one help me to achieve this. I am trying getting this manually but its more time consuming.

    Outlook.AppointmentItem aitem = item as Outlook.AppointmentItem;
    if (aitem.IsRecurring == true)
                    Outlook.RecurrencePattern pattern = aitem.GetRecurrencePattern();
         if (noEndDate == true)
                    var patternEndDate = new DateTime(DateTime.Now.Year, 12, 31);
                    pattern.PatternEndDate = patternEndDate;
                        var totalOcc = pattern.GetOccurrence(pattern.PatternStartDate);
                    catch (System.Exception ex)


    Monday, June 30, 2014 4:01 AM


All replies