public AppointmentItem CreateAppointmentPattern(string subj, int categoryId) {
AppointmentItem apt = new AppointmentItem(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(9);
apt.End = apt.Start.AddMinutes(5);
apt.Subject = subj;
apt.LabelId = categoryId;
return apt;
}
// An appointment is set every 3 days. Five occurrences.
AppointmentItem apt1 = CreateAppointmentPattern("Every 3 days. Five occurrences.", 2);
apt1.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt1.Start, 5).Interval(3).Build());
scheduler.AppointmentItems.Add(apt1);
// An appointment is set every day. Infinite (no end date).
AppointmentItem apt2 = CreateAppointmentPattern("Every day. Infinite (no end date).", 2);
apt2.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt2.Start).Build());
scheduler.AppointmentItems.Add(apt2);
// An appointment occurs every five days. Appointments are set for one month.
AppointmentItem apt3 = CreateAppointmentPattern("Every 5 days. Series for one month.", 2);
apt3.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt3.Start, apt3.Start.AddMonths(1)).Interval(5).Build());
scheduler.AppointmentItems.Add(apt3);
Public Function CreateAppointmentPattern(ByVal subj As String, ByVal categoryId As Integer) As AppointmentItem
Dim apt As New AppointmentItem(AppointmentType.Pattern)
apt.Start = Date.Today.AddHours(9)
apt.End = apt.Start.AddMinutes(5)
apt.Subject = subj
apt.LabelId = categoryId
Return apt
End Function
' An appointment is set every 3 days. Five occurrences.
Private apt1 As AppointmentItem = CreateAppointmentPattern("Every 3 days. Five occurrences.", 2)
apt1.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt1.Start, 5).Interval(3).Build())
scheduler.AppointmentItems.Add(apt1)
' An appointment is set every day. Infinite (no end date).
Dim apt2 As AppointmentItem = CreateAppointmentPattern("Every day. Infinite (no end date).", 2)
apt2.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt2.Start).Build())
scheduler.AppointmentItems.Add(apt2)
' An appointment occurs every five days. Appointments are set for one month.
Dim apt3 As AppointmentItem = CreateAppointmentPattern("Every 5 days. Series for one month.", 2)
apt3.SetRecurrenceInfo(RecurrenceBuilder.Daily(apt3.Start, apt3.Start.AddMonths(1)).Interval(5).Build())
scheduler.AppointmentItems.Add(apt3)