Import and Export

You can add importing and exporting functionality to your scheduling application using the Import and Export methods of the C1ScheduleStorage class. These methods allow the importing and exporting of scheduling data in XML, iCal, and binary formats. These formats can be set by using the XML, iCal, and Binary values of the FileFormatEnum enumeration, respectively. The Import and Export methods are essential for integrating scheduling data across different systems or saving it for future use.

In the following example, you will be importing and exporting data using the iCal format. The C1Scheduler and two button controls are added to the form named sched, Import and Export respectively. When the application is run, you will be able to import and export data into the C1Scheduler control. Complete the following steps to add importing and exporting functionality to a scheduling application:

  1. Create a new .NET application.
  2. In the XAML, add the scheduler and two button controls as shown below:
    XAML
    Copy Code
    <c1:C1Scheduler Name="sched" Loaded="sched_Loaded"/>
    <Button Content="Import" HorizontalAlignment="Left" Margin="100,20,0,0" VerticalAlignment="Top" Height="33" Width="89" Click="Import_Click"/>
    <Button Content="Export" HorizontalAlignment="Left" Margin="200,20,0,0" VerticalAlignment="Top" Height="33" Width="89" Click="Export_Click"/>
    
  3. Double-click the Import button. The Code Editor will open, and the Import_Click event will be added. Add the below code to enable importing files
    CS
    Copy Code
    sched.DataStorage.Import("AppointmentData.ics", C1.Schedule.FileFormatEnum.iCal)
    
    .
  4. Double-click the Export button. The Code Editor will open, and the Export_Click event will be added. Add the below code to enable exporting files:
    CS
    Copy Code
    sched.DataStorage.Export("AppointmentData.ics", C1.Schedule.FileFormatEnum.iCal)
    
  5. Run the application.
  6. Add a few appointments to the schedule.
  7. Click the Export button to save the appointments in the AppointmentData.ics file.
  8. Click the Import button to load the appointments from the AppointmentData.ics file in your application.