Could anyone provide an example of recurrence rule exception in the latest build (2011.1 419 )? In the documentation it says you must use the AddException method. But I could not find it.
Thanks.
1 Answer, 1 is accepted
0
Yana
Telerik team
answered on 19 May 2011, 02:38 PM
Hello Oscar,
AddException is a method of the ReccurrenceRule which is set to the appointment. If you provide only one DateTime parameter to the AddException method, the given occurrence will be removed from the recurrence. Note that you should specify the exact Start time of the occurrence. Here is an example of a recurrent appointment with an exception:
var now = DateTime.Now;
var pattern = newRecurrencePattern() {
Frequency = RecurrenceFrequency.Weekly
};
var rule = newRecurrenceRule(pattern);
rule.AddException(now.AddDays(7));
var recurrentApp = newAppointment()
{
Subject = "recurrent app",
Start = now,
End = now.AddHours(1),
RecurrenceRule = rule
};
If you need to keep the appointment occurrence but change any of its properties (Subject, Start, End..), you should provide two parameters to the AddException method - again DateTime and the exception appointment:
var now = DateTime.Now;
var pattern = newRecurrencePattern() {
Frequency = RecurrenceFrequency.Weekly
};
var recurrentApp = newAppointment()
{
Subject = "recurrent app",
Start = now,
End = now.AddHours(1)
};
var rule = newRecurrenceRule(pattern);
rule.AddException(now, recurrentApp.Copy());
recurrentApp.RecurrenceRule = rule;
Hope this help.
Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items