Skip to main content
A newer version of this page is available. .

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.v18.2.Core.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


***


> [!NOTE]
> A complete sample project is available at [https://github.com/DevExpress-Examples/winforms-schedulercontrol-api-t224044](https://github.com/DevExpress-Examples/winforms-schedulercontrol-api-t224044)



# [Recurrence.cs](#tab/tabid-csharpRecurrence-cs)

```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();

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExtractRecurrenceRule(IRecurrenceInfo) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also