![]() Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 58 of 90
'End the recurrence by date and on this date
recurrence.StartDate = appointment.StartDate
recurrence.EndDate = #6/27/2005#
recurrence.EndType = RecurrenceEndConstants.recEndByDate
recurrence.RecurrenceInterval = RecurrenceIntervalConstants.ricWeekly
'Setup the RecurrenceDay object
'Every 7 days for all days including weekends
recurrence.RecurrenceWeek.WeekInterval = 1
recurrence.RecurrenceWeek.UseMon = True
'Add the recurrence
Schedule1.AppointmentCollection.AddRecurrence(appointment, recurrence)
The UseMon property is set because by default all of the Use properties (UseSun,
UseMon, etc) are false. I knew this appointment was on Mondays so I set it to true to
allow appointments to be scheduled on Mondays. These properties are useful when you
want to schedule weekly appointments by do not want them to be scheduled on specific
days.
The most complicated mode is Month. This has different and somewhat confusing
properties that have values that are not intuitive. You can setup a recurrence by interval
or ordinal. By Interval, specifies the day of the month on which to recur, like the third (3)
day of the month. By Ordinal, specifies a named day like the second Tuesday of each
month. In the following example the recurrence pattern is monthly, by interval. The
appointment will be repeated on the third of the month, every two months. Only three
appointments will be created by the recurrence pattern as set by the EndIterations
property.
Dim appointment As Appointment
appointment = Schedule1.AppointmentCollection.Add("", _
#6/6/2005#, #8:00:00 AM#, 60)
appointment.Subject = "John Doe"
'Create and setup the recurrence
Dim recurrence As New Recurrence
'End the recurrence by interval after 3 appointments added
'and on this date
recurrence.StartDate = appointment.StartDate
recurrence.EndType = RecurrenceEndConstants.recEndByInterval
recurrence.EndIterations = 3
recurrence.RecurrenceInterval = RecurrenceIntervalConstants.ricMonthly
'Setup the RecurrenceDay object
'Add an appointment the 3 day of every 2 month
recurrence.RecurrenceMonth.MonthInterval = 2
recurrence.RecurrenceMonth.RecurrenceMode = _
RecurrenceMonthConstants.MonthInterval
recurrence.RecurrenceMonth.DayInterval = 3
'Add the recurrence
Schedule1.AppointmentCollection.AddRecurrence(appointment, recurrence)
|