Skip to main content

How to: Create Appointments with Various Recurrence Types Programmatically

  • 2 minutes to read

This document illustrates how recurring appointments with different periodicity and number of occurrences can be created in code. Many examples are provided to help you in specifying complex periodical conditions.

Follow the steps listed below. First, create a new appointment pattern. Then, modify its recurrence information as required via the Appointment.RecurrenceInfo property. You can specify only one type of recurrence - every minute, hour, day, week, or year. Finally, add the appointment to the storage.

1. Create a Pattern

An appointment pattern which starts at 3 AM on the current date finishes at 8:15 will be created. So the first appointment in a series will start at 3 AM and will last for 15 minutes.

Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(3);
apt.End = apt.Start.AddMinutes(15);
apt.Subject = "My Subject";
apt.Location = "My Location";
apt.Description = "My Description";

2. Specify a Minutely Recurrence

Recurrence - Minutely (examples)

3. Specify an Hourly Recurrence

Recurrence - Hourly (examples)

4. Specify a Daily Recurrence

Recurrence - Daily (examples)

5. Specify a Weekly Recurrence

Recurrence - Weekly (examples)

6. Specify a Monthly Recurrence

Recurrence - Monthly (examples)

7. Specify a Yearly Recurrence

Recurrence - Yearly (examples)

8. Specify Recurrence with Exceptions

Recurrence - Exceptions (examples)

9. The Final Step

And finally, add an appointment to the storage:

schedulerControl1.Storage.Appointments.Add(apt);
See Also