Back to Devexpress

iCalendarHelper.ExtractRecurrenceRule(IRecurrenceInfo) Method

corelibraries-devexpress-dot-xtrascheduler-dot-icalendar-dot-icalendarhelper-dot-extractrecurrencerule-x28-devexpress-dot-xtrascheduler-dot-irecurrenceinfo-x29.md

latest4.6 KB
Original Source

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.v25.2.Core.Desktop.dll

NuGet Package : DevExpress.Scheduler.CoreDesktop

Declaration

csharp
public static string ExtractRecurrenceRule(
    IRecurrenceInfo recurrenceInfo
)
vb
Public Shared Function ExtractRecurrenceRule(
    recurrenceInfo As IRecurrenceInfo
) As String

Parameters

NameTypeDescription
recurrenceInfoIRecurrenceInfo

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

|

Returns

TypeDescription
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

csharp
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();
vb
scheduler.Storage.Appointments.Clear()
Dim apt As Appointment = scheduler.Storage.CreateAppointment(AppointmentType.Pattern)
apt.Start = Date.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 Or WeekDays.Wednesday
apt.RecurrenceInfo.Range = RecurrenceRange.OccurrenceCount
apt.RecurrenceInfo.OccurrenceCount = 15

Dim s As String = 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

iCalendarHelper Class

iCalendarHelper Members

DevExpress.XtraScheduler.iCalendar Namespace