Skip to main content

Recurrence - Exceptions (examples)

An appointment occurs every hour for 24 hours. There are no appointments at 7 AM, 1 PM and 6 PM. An appointment at 3 PM starts 15 minutes later than normal.

apt.RecurrenceInfo.Type = RecurrenceType.Hourly;
apt.RecurrenceInfo.Start = apt.Start;
apt.RecurrenceInfo.Periodicity = 1;
apt.RecurrenceInfo.Range = RecurrenceRange.EndByDate;
apt.RecurrenceInfo.End = apt.RecurrenceInfo.Start.AddHours(24);
apt.CreateException(AppointmentType.DeletedOccurrence, 7);
apt.CreateException(AppointmentType.DeletedOccurrence, 13);
apt.CreateException(AppointmentType.DeletedOccurrence, 18);
apt.GetOccurrence(15).Start = apt.GetOccurrence(15).Start.AddMinutes(15);
See Also