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

How to: Export Data to iCalendar (legacy)

  • 2 minutes to read

Note

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

The following example demonstrates how to export data from a scheduler to the iCalendar format. To do this, create an iCalendarExporter class instance and call the AppointmentExporter.Export method with a parameter set to a stream that specifies the .ics file selected by an end-user.

private void Export_Button_Click(object sender, RoutedEventArgs e) {
    SaveFileDialog dialog = new SaveFileDialog();
    dialog.Filter = "iCalendar files (*.ics)|*.ics";
    dialog.FilterIndex = 1;
    if (dialog.ShowDialog() == true) {
        using (Stream stream = dialog.OpenFile()) {
            ExportAppointments(stream);
        }
    }
}
void ExportAppointments(Stream stream) {
    if (stream == null)
        return;
    iCalendarExporter exporter = new iCalendarExporter(schedulerControl1.Storage.InnerStorage);
    exporter.ProductIdentifier = "-//Developer Express Inc.//DXScheduler iCalendarExchange Example//EN";
    exporter.Export(stream);
}
See Also