Back to Devexpress

IRecurrenceInfo.ToXml() Method

corelibraries-devexpress-dot-xtrascheduler-dot-irecurrenceinfo-e5b421b4.md

latest8.0 KB
Original Source

IRecurrenceInfo.ToXml() Method

Creates an XML encoding of the recurrence information.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.Core.dll

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
string ToXml()
vb
Function ToXml As String

Returns

TypeDescription
String

A String value that represents an XML encoding of the recurrence information object.

|

Example

This example illustrates the use of the IRecurrenceInfo.ToXml method to obtain recurrence info in XML format.

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the ToXml() 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.

wpf-scheduler-use-entity-framework-to-bind-to-data/CS/DXSample/Data/DataHelper.cs#L219

csharp
};
appt.RecurrenceInfo = RecurrenceBuilder.Weekly(newStart, 10).ByDay(WeekDays.Monday | WeekDays.Wednesday).Build().ToXml();
return appt;

wpf-scheduler-filter-time-regions/CS/DXSample/Data/DataHelper.cs#L241

csharp
};
appt.RecurrenceInfo = RecurrenceBuilder.Weekly(newStart, 10)
    .ByDay(WeekDays.Monday | WeekDays.Wednesday)

report-server-how-to-manage-scheduled-jobs-from-a-windows-forms-application/CS/ScheduledTasksAPIClientDemo/SchedulerJobViewerForm.cs#L201

csharp
apt.RecurrenceInfo.WeekDays = WeekDays.WorkDays;
    scheduledJob.SerializedRecurrenceInfo = apt.RecurrenceInfo.ToXml();
}

wpf-scheduler-create-regular-and-recurring-appointments-at-view-model-level/CS/DXApplication14/MainViewModel.cs#L42

csharp
appt.Type = (int)AppointmentType.Pattern;
    appt.RecurrenceInfo = RecurrenceBuilder.Daily(Interval.Start, 10).Build().ToXml();
} else {

wpf-scheduler-use-entity-framework-to-bind-to-data/VB/DXSample/Data/DataHelper.vb#L122

vb
Dim appt = New DXSample.Data.AppointmentEntity() With {.AppointmentType = CInt(DevExpress.XtraScheduler.AppointmentType.Pattern), .Start = newStart, .[End] = newEnd, .ResourceId = 2, .Subject = "French lesson", .Label = 3, .Description = "Another french lesson.Once again, without mastering French, our success on the Continent will be less likely.Everyone needs to learn French."}
appt.RecurrenceInfo = DevExpress.Xpf.Scheduling.RecurrenceBuilder.Weekly(CDate((newStart)), CInt((10))).ByDay(CType((DevExpress.XtraScheduler.WeekDays.Monday Or DevExpress.XtraScheduler.WeekDays.Wednesday), DevExpress.XtraScheduler.WeekDays)).Build().ToXml()
Return appt

wpf-scheduler-filter-time-regions/VB/DXSample/Data/DataHelper.vb#L122

vb
Dim appt = New DXSample.Data.AppointmentEntity() With {.AppointmentType = CInt(DevExpress.XtraScheduler.AppointmentType.Pattern), .Start = newStart, .[End] = newEnd, .ResourceId = 2, .Subject = "French lesson", .Label = 3, .Description = "Another french lesson.Once again, without mastering French, our success on the Continent will be less likely.Everyone needs to learn French."}
appt.RecurrenceInfo = DevExpress.Xpf.Scheduling.RecurrenceBuilder.Weekly(CDate((newStart)), CInt((10))).ByDay(CType((DevExpress.XtraScheduler.WeekDays.Monday Or DevExpress.XtraScheduler.WeekDays.Wednesday), DevExpress.XtraScheduler.WeekDays)).Build().ToXml()
Return appt

report-server-how-to-manage-scheduled-jobs-from-a-windows-forms-application/VB/ScheduledTasksAPIClientDemo/SchedulerJobViewerForm.vb#L208

vb
apt.RecurrenceInfo.WeekDays = WeekDays.WorkDays
    scheduledJob.SerializedRecurrenceInfo = apt.RecurrenceInfo.ToXml()
End Using

wpf-scheduler-create-regular-and-recurring-appointments-at-view-model-level/VB/DXApplication14/MainViewModel.vb#L58

vb
appt.Type = CInt(DevExpress.XtraScheduler.AppointmentType.Pattern)
    appt.RecurrenceInfo = DevExpress.Xpf.Scheduling.RecurrenceBuilder.Daily(CDate((Me.Interval.Start)), CInt((10))).Build().ToXml()
Else

See Also

FromXml

IRecurrenceInfo Interface

IRecurrenceInfo Members

DevExpress.XtraScheduler Namespace