IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
public
static
string
GetRecurrenceExpression()
{
var startDate =
new
DateTime(2013, 3, 1);
var recursUntil =
DateTime(2013, 3, 3);
var duration = TimeSpan.FromMinutes(30);
var maxOccurrences = 0;
var interval = 1;
IRecurrenceDescriptor dailyDescriptor =
null
;
var rrBuilder =
RecurrenceRuleBuilder();
var dailyExpression = rrBuilder.CreateDailyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, interval);
//if isParsed returns true the iCal daily recurrence expression is parsed
var isParsed = rrBuilder.TryParseRecurrenceExpression(dailyExpression,
out
dailyDescriptor);
dailyExpressionReParsed = rrBuilder.GetRecurrenceExpression(dailyDescriptor);
return
dailyExpression;
}
bool
TryParseRecurrenceExpression()
isParsed = rrBuilder.TryParseRecurrenceExpression(dailyExpression,
isParsed;
CreateDailyRecurrenceExpression()
var recurUntil =
int
interval = 1;
maxOccurrences = 0;
var dailyExpression = rrBuilder.CreateDailyRecurrenceExpression(startDate, duration, recurUntil, maxOccurrences, interval);
CreateWeeklyRecurrenceExpression()
RecurrenceDay daysOfWeek = RecurrenceDay.WeekDays;
var weeklyExpression = rrBuilder.CreateWeeklyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, interval, daysOfWeek);
weeklyExpression;
CreateWeeklyRecurrenceExpressionByFirstDayOfWeek()
var weeklyExpression = rrBuilder.CreateWeeklyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, interval, RecurrenceDay.Friday);
CreateMonthlyRecurrenceExpression()
dayOfMonth = 17;
var monthlyExpression = rrBuilder.CreateMonthlyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, dayOfMonth, interval);
monthlyExpression;
CreateMonthlyRecurrenceExpressionByDaysOfWeek()
dayOrdinal = 2;
var monthlyExpression = rrBuilder.CreateMonthlyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, dayOrdinal, daysOfWeek, interval);
CreateYearlyRecurrenceExpression()
dayOfMonth = 2;
RecurrenceMonth months = RecurrenceMonth.August | RecurrenceMonth.September | RecurrenceMonth.October;
var yearlyExpression = rrBuilder.CreateYearlyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, months, dayOfMonth);
yearlyExpression;
CreateYearlyRecurrenceExpressionByDaysOfWeek()
var builder =
var yearlyExpression = builder.CreateYearlyRecurrenceExpression(startDate, duration, recursUntil, maxOccurrences, dayOrdinal, months, daysOfWeek);
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important