Skip to main content

iCalendarHelper.ExtractRecurrenceRule(IRecurrenceInfo) Method

Obtains a recurrence rule in iCalendar format from the information contained in the RecurrenceInfo class instance.

Namespace: DevExpress.XtraScheduler.iCalendar

Assembly: DevExpress.XtraScheduler.v24.2.Core.Desktop.dll

Declaration

public static string ExtractRecurrenceRule(
    IRecurrenceInfo recurrenceInfo
)

Parameters

Name Type Description
recurrenceInfo IRecurrenceInfo

An object that expose the IRecurrenceInfo interface - the RecurrenceInfo object that contains appointment recurring information.

Returns

Type Description
String

A string that is the recurrence rule.

Remarks

Use the iCalendarHelper.ExtractRecurrenceRule method to obtain a recurrence rule string (the RRULE property in iCalendar format); use the iCalendarHelper.ApplyRecurrenceRule to apply a new recurrence rule specified in iCalendar format to the RecurrenceInfo object.

Example

This code snippet illustrates the use of the iCalendarHelper.ExtractRecurrenceRule method to obtain a RRULE string (recurrence rule in iCalendar format) from the RecurrenceInfo object.

The appointment in this example recurs every 2 weeks, on Monday and Wednesday. It occurs 15 times. Its recurrence rule is:

icalendar rfc 2445 recurrence rule

RRULE:FREQ=WEEKLY;COUNT=15;INTERVAL=2;BYDAY=MO,WE

scheduler.Storage.Appointments.Clear();
Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(3);
apt.End = apt.Start.AddHours(2);
apt.Subject = "TEST";

apt.RecurrenceInfo.Type = RecurrenceType.Weekly;
apt.RecurrenceInfo.Start = apt.Start;
apt.RecurrenceInfo.Periodicity = 2;
apt.RecurrenceInfo.WeekDays = WeekDays.Monday | WeekDays.Wednesday;
apt.RecurrenceInfo.Range = RecurrenceRange.OccurrenceCount;
apt.RecurrenceInfo.OccurrenceCount = 15;

string s = DevExpress.XtraScheduler.iCalendar.iCalendarHelper.ExtractRecurrenceRule(apt.RecurrenceInfo);
apt.Description = "RRULE:" + s + Environment.NewLine;
scheduler.Storage.Appointments.Add(apt);
apt.Description += apt.RecurrenceInfo.ToXml();
See Also