Back to Devexpress

How to: Export Data to vCalendar

windowsforms-2279-controls-and-libraries-scheduler-examples-data-exchange-how-to-export-data-to-vcalendar.md

latest1.6 KB
Original Source

How to: Export Data to vCalendar

  • Sep 13, 2023

The following example demonstrates how to export data from a SchedulerDataStorage to the vCalendar format. To do this you should use two overloads of the SchedulerDataStorage.ExportToVCalendar method. Note that these methods allow both exporting data either to a file, or to a stream.

csharp
using System.IO;
using DevExpress.XtraScheduler;
// ...

// Save appointments to a file in the vCalendar format.
private string StoreToVCalendarFile(SchedulerDataStorage storage){
    string path = "C:\\Temp\\Appointments.vcs";
    storage.ExportToVCalendar(path);
    return path;
}

// Save appointments to a stream in the vCalendar format.
private MemoryStream StoreToVCalendarStream(SchedulerDataStorage storage){
    MemoryStream stream = new MemoryStream();
    storage.ExportToVCalendar(stream);
    return stream;
}

// ...
vb
Imports System.IO
Imports DevExpress.XtraScheduler
' ...

' Save appointments to a file in the vCalendar format.
Private Function StoreToVCalendarFile(Storage As SchedulerDataStorage) As String
    Dim Path As String = "C:\Temp\Appointments.vcs"
    Storage.ExportToVCalendar(Path)
    Return Path
End Function

' Save appointments to a stream in the vCalendar format.
Private Function StoreToVCalendarStream(Storage As SchedulerDataStorage) As MemoryStream
    Dim Stream As New MemoryStream()
    Storage.ExportToVCalendar(Stream)
    Return Stream
End Function

' ...