How to: Create Minutely Recurrence

  • 2 minutes to read
<dxsch:SchedulerControl.AppointmentItems>
    <!--An appointment is set every 10 minutes. Five occurrences.-->
    <dxsch:AppointmentItem 
        Type="Pattern"
        Start="1/1/2020 13:00:00"
        End="1/1/2020 14:00:00"
        Subject="Every 10 minutes. Five occurrences."
        RecurrenceInfo="{dxsch:RecurrenceMinutely Start='1/1/2020 13:00:00', Interval=10, OccurrenceCount=5}" />
    <!--An appointment is set every 45 minutes. Infinite (no end time).-->
    <dxsch:AppointmentItem 
        Type="Pattern"
        Start="1/1/2020 13:00:00"
        End="1/1/2020 14:00:00"
        Subject="Every 45 minutes. Infinite."
        RecurrenceInfo="{dxsch:RecurrenceMinutely Start='1/1/2020 13:00:00', Interval=45}" />
    <!--An appointment is set every 20 minutes. The appointment chain duration is 10 hours.-->
    <dxsch:AppointmentItem 
        Type="Pattern"
        Start="1/1/2020 13:00:00"
        End="1/1/2020 14:00:00"
        Subject="Every 20 minutes. Series duration is 10 hours."
        RecurrenceInfo="{dxsch:RecurrenceMinutely Start='1/1/2020 13:00:00', Interval=20, End='1/1/2020 23:00:00'}" />
</dxsch:SchedulerControl.AppointmentItems>
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 10 minutes. Five occurrences.
    AppointmentItem apt1 = CreateAppointmentPattern("Every 10 minutes. Five occurrences.", 0);
    apt1.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt1.Start, 5).Interval(10).Build());
    scheduler.AppointmentItems.Add(apt1);

    // An appointment is set every 45 minutes. Infinite (no end time).
    AppointmentItem apt2 = CreateAppointmentPattern("Every 45 minutes. Infinite", 0);
    apt2.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt2.Start).Interval(45).Build());
    scheduler.AppointmentItems.Add(apt2);

    // An appointment is set every 20 minutes. The appointment chain duration is 10 hours.
    AppointmentItem apt3 = CreateAppointmentPattern("Every 20 minutes. Series duration is 10 hours.", 0);
    apt3.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt3.Start, apt3.Start.AddHours(10)).Interval(20).Build());
    scheduler.AppointmentItems.Add(apt3);