How to save Appointments?

4 posts, 0 answers
  1. Troy
    Troy avatar
    18 posts
    Member since:
    Jul 2020

    Posted 12 Oct 2020 Link to this post

    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

  2. Troy
    Troy avatar
    18 posts
    Member since:
    Jul 2020

    Posted 12 Oct 2020 in reply to Troy Link to this post

    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.
  3. Troy
    Troy avatar
    18 posts
    Member since:
    Jul 2020

    Posted 12 Oct 2020 Link to this post

    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)
  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4120 posts

    Posted 13 Oct 2020 Link to this post

    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).

Back to Top