Version

Add a Recurring Appointment Server Side

Adding a recurring appointment involves three steps:

  1. Create an Appointment .

  2. Create the Recurrence object.

  3. Add the appointment to the database.

You don’t have to create an entirely new appointment to create a Recurrence object. You can create the Recurrence object from any previously created appointment. Until the Recurrence object is created, the appointment’s Recurrence object will be Null/Nothing. Once created, you can set properties on the Recurrence object and add the appointment to the database.

In Visual Basic:

Imports Infragistics.WebUI.Shared
Imports Infragistics.WebUI.WebSchedule
...
' Create a new appointment and set its subject and start date.
Dim appointment As New Appointment(Me.WebScheduleInfo1)
appointment.Subject = "My Recurring Appointment"
appointment.StartDateTime = New SmartDate(DateTime.Now)
' Set Key property to a unique value on each appointment.
appointment.Key = "100"
' Create the recurrence object from the appointment you just created.
appointment.CreateRecurrence()
' Create a new recurrence object to represent the appointment's
' recurrence object.
Dim recurrenceObject As Recurrence = appointment.Recurrence
recurrenceObject.Period = RecurrencePeriod.Daily
recurrenceObject.PeriodMultiple = 1
recurrenceObject.MaxOccurrences = 3
' Add the appointment to the data provider.
Me.WebScheduleOleDbProvider1.AddActivity(appointment, Me.WebScheduleInfo1.ActiveResource)

In C#:

using Infragistics.WebUI.Shared;
using Infragistics.WebUI.WebSchedule;
...
// Use the following using directives so you don't have to
// type out the fully qualified name everytime.
using Infragistics.WebUI.Shared;
using Infragistics.WebUI.WebSchedule;
// Create a new appointment and set its subject and start date.
Appointment appointment = new Appointment(this.WebScheduleInfo1);
appointment.Subject = "My Recurring Appointment";
appointment.StartDateTime = new SmartDate(DateTime.Now);
// Set Key property to a unique value on each appointment.
appointment.Key = "100";
// Create the recurrence object from the appointment you just created.
appointment.CreateRecurrence();
// Create a new recurrence object to represent the appointment's
// recurrence object.
Recurrence recurrenceObject = appointment.Recurrence;
recurrenceObject.Period = RecurrencePeriod.Daily;
recurrenceObject.PeriodMultiple = 1;
recurrenceObject.MaxOccurrences = 3;
// Add the appointment to the data provider.
this.WebScheduleOleDbProvider1.AddActivity(appointment,
  this.WebScheduleInfo1.ActiveResource);