How to: Modify Components of the Exported iCal Structure

  • 2 minutes to read

The following example illustrates how you can change the default METHOD value (currently set to PUBLISH) of the VCalendar component, located in iCalendar file, as shown below:




The RFC 2446 specifies different methods that are defined for the "VEVENT" calendar component (e.g. REQUEST that makes a request for an event, CANCEL that cancels one or more instances of an existing event and others).

To modify the method's value, use the calendar structure constructed by the iCalendarExporter and available via handling the iCalendarImporter.CalendarStructureCreated event.

using DevExpress.XtraScheduler.iCalendar;
using DevExpress.XtraScheduler.iCalendar.Components;
// ...
    iCalendarExporter exporter = new iCalendarExporter(schedulerStorage1, aptCollection);
    exporter.CalendarStructureCreated += 
        new iCalendarStructureCreatedEventHandler(exporter_CalendarStructureCreated);
void exporter_CalendarStructureCreated(object sender, iCalendarStructureCreatedEventArgs e)
            iCalendarComponent cal = e.Calendars[0];
            ((StringPropertyBase)(cal.Method)).Value = "REQUEST";


This example illustrates the use of the AppointmentExporter.AppointmentExported event to add a custom property to the VEVENT component of the iCalendar object. The RFC 2446 defines the ORGANIZER property of an event, which specifies the calendar user who initiates a scheduling exchange, e.g. the one who proposes a group meeting. To add this property to an event exported to iCal format, the following code can be used:

using DevExpress.XtraScheduler.iCalendar;
using DevExpress.XtraScheduler.iCalendar.Components;
using DevExpress.XtraScheduler.iCalendar.Native;
// ...
    iCalendarExporter exporter = new iCalendarExporter(schedulerStorage);
    exporter.AppointmentExported += new AppointmentExportedEventHandler(exporter_AppointmentExported);

    void exporter_AppointmentExported(object sender, AppointmentExportedEventArgs e) 
        iCalendarAppointmentExportedEventArgs args = (iCalendarAppointmentExportedEventArgs)e;
        iContentLineParameters parameters = new iContentLineParameters();
        iContentLineParam param1 = new iContentLineParam();
        CustomProperty property = new CustomProperty("ORGANIZER", parameters,