schedule component, sync with google calendar

Hi,
   In the schedule component documentation, it says: "Easy synchronization of events with Google and Outlook calendars."

  I can not find any example of sync to Google Calendar.

   Could you provide an example please?

Regards, Diego.

1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team October 31, 2018 11:04 AM UTC

Hi Diego, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to sync Schedule with google calendar, which can be downloaded from the below link 
 

Please follow the below steps for synchronization. 
 
Step1: Follow the steps in the below link to configure the google calendar to access its events. 
 
Step2: Render the EJ2 schedule in index page. 
 
Step 3: Form the google calendar data source like Schedule data source as shown below.  
 
        // List events. 
            Events events = request.Execute(); 
            // Google calendar data 
            List<AppointmentData> appData = new List<AppointmentData>(); 
            if (events.Items != null && events.Items.Count > 0) 
            { 
                var i = 0; 
                foreach (var eventItem in events.Items) 
                { 
                    
                    appData.Add(new AppointmentData 
                    { 
                        Id = i++, 
                        Subject = eventItem.Summary, 
                        StartTime = Convert.ToDateTime( eventItem.Start.DateTime), 
                        EndTime = Convert.ToDateTime(eventItem.End.DateTime) 
                    }); 
                } 
           } 
            //Schedule data 
            List<AppointmentData> scheduleData = new List<AppointmentData>(); 
            scheduleData.Add(new AppointmentData 
            { 
                Id = 100, 
                Subject = "Paris", 
                StartTime = new DateTime(2018, 11, 15, 10, 0, 0), 
                EndTime = new DateTime(2018, 11, 15, 12, 30, 0), 
            }); 
            // Merge both schedule and google calendar data and assign it to the datasource of schedule 
            List<AppointmentData> resultData = new List<AppointmentData>(); 
            resultData = appData.Concat(scheduleData).ToList(); 
            ViewBag.appointments = resultData; 
 
 public class AppointmentData 
    { 
        public int Id { get; set; } 
        public string Subject { get; set; } 
        public DateTime StartTime { get; set; } 
        public DateTime EndTime { get; set; } 
       
    } 
 
Step 4: Assign both Schedule and google calendar data source to Schedule through ViewBag as shown above. 
 
Regards, 
Karthigeyan 


Loader.
Up arrow icon