Skip to main content

IRecurrenceInfo.FromXml(String) Method

Reconstructs the recurrence information from a string in XML format.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.1.Core.dll

NuGet Package: DevExpress.Scheduler.Core

Declaration

void FromXml(
    string val
)

Parameters

Name Type Description
val String

A String value that is the string containing recurrence information in XML format.

Remarks

You are advised to use the Mappings mechanism to save and restore persistent objects instead.

Example

This code snippet illustrates how to set the appointment’s recurrence info from XML string using the IRecurrenceInfo.FromXml method and create an IRecurrenceInfo object using the RecurrenceInfoXmlPersistenceHelper class.

string head = "<RecurrenceInfo ";
string startText = String.Format("Start = '{0}' " , DateTime.Today.AddHours(3));
string endText = String.Format("End = '{0}' ", DateTime.Today.AddHours(4));
string weekDays = String.Format("Weekdays='{0}' ", 10);
string id = String.Format("Id = '{0}' ", Guid.NewGuid());
string occurrenceCount = String.Format("OccurrenceCount = '{0}' ", 15);
string periodicity = String.Format("Periodicity = '{0}' ", 2);
string range = String.Format("Range = '{0}' ", 1);
string type = String.Format("Type = '{0}' ", 1);
string version = String.Format("Version = '{0}' ", 1);
string tail = " />";
string recurrenceXmlString = (head + startText + endText + weekDays +
    id + occurrenceCount + periodicity + range + type + version + tail).Replace("'", "\"");
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 = "Recurrence From XML";

// Set appointment recurrence from XML.
apt.RecurrenceInfo.FromXml(recurrenceXmlString);
// Get recurrence info from XML.
IRecurrenceInfo rec = DevExpress.XtraScheduler.Xml.RecurrenceInfoXmlPersistenceHelper.ObjectFromXml(recurrenceXmlString);

apt.Description = recurrenceXmlString + Environment.NewLine + String.Format("Type: {0}",rec.Type);
scheduler.Storage.Appointments.Add(apt);

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FromXml(String) 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