This is a migrated thread and some comments may be shown as answers.

How to save Appointments?

3 Answers 218 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Troy asked on 12 Oct 2020, 05:11 PM

I looked at the document here: https://docs.telerik.com/devtools/winforms/controls/scheduler/importing-and-exporting-appointments/export-to-a-custom-file

 

However that's not really the question I have.  How are appointments saved without data binding, to a file? The above example is how to save custom data to a file, but I'm trying to figure out how to save appointments that aren't custom.  I'd like to be able to write them out as JSON or something like that, and allow them to be imported that way as well.

I was able to get the list of events, but when I attempted to serialize them using Newtonsofts JSON, it throws an error. 

The error I get is: 

Newtonsoft.Json.JsonSerializationException: 'Self referencing loop detected for property 'Scheduler' with type 'Telerik.WinControls.UI.RadScheduler'. Path 'CultureInfoProvider.SchedulerInputBehavior'.'

Here is the code I was using to iterate over the appointments and attempt to serialize each appointment:

 

        Dim events As ISchedulerStorage(Of IEvent) = data.GetEventStorage()
        For Each ev As IEvent In events
            Dim jsonEvent As String = JsonConvert.SerializeObject(ev, Formatting.Indented)
        Next

3 Answers, 1 is accepted

Sort by
0
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 12 Oct 2020, 05:39 PM
To be clear, ultimately all I want to do is save/load appointments, without any data binding and using a file as the appointment source/destination.
0
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 12 Oct 2020, 06:44 PM
I think I'll just use the iCal export for now.  However, please update the above linked document as its broken in many ways and not very useful. (C# code in the VB.NET example, import uses the File.Create instead of File.OpenRead, etc)
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Oct 2020, 07:21 AM

Hello, Troy,   

By default, RadScheduler allows you to export and import appointments from the industry-standard ICalendar format:
https://docs.telerik.com/devtools/winforms/controls/scheduler/importing-and-exporting-appointments/import-from-icalendar 
https://docs.telerik.com/devtools/winforms/controls/scheduler/importing-and-exporting-appointments/export-to-icalendar 

Thus, the appointments available in RadScheduler are stored into a .ics file and you can load them at a later moment. I would recommend you to follow this approach.

If the ICalendar format doesn't fit your scenario, you can build your own logic by creating ISchedulerImporter/ISchedulerExporter classes that contain the logic for storing and restoring the appointments: https://docs.telerik.com/devtools/winforms/controls/scheduler/importing-and-exporting-appointments/export-to-a-custom-file 

However, the exact custom implementation is up to the developer in this case. Feel free to use this approach which suits your requirements best.
 
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
Scheduler and Reminder
Asked by
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or