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.
Perform the following simple steps. 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
3. Specify an Hourly Recurrence
4. Specify a Daily Recurrence
5. Specify a Weekly Recurrence
6. Specify a Monthly Recurrence
7. Specify a Yearly Recurrence
8. Specify Recurrence with Exceptions
9. The Final Step
And finally, add an appointment to the storage: