Samsung Electronics logo

Adding Events to a Calendar in the Batch Mode

To create engaging applications with various calendar features, you must learn to add events to calendars in the batch mode:

  1. Retrieve the default system calendar using the getDefaultCalendar() method of the CalendarManager interface:

    calendar = webapis.calendar.getDefaultCalendar("EVENT");
  2. Define the items to be added as an array:

    var ev = new webapis.CalendarEvent
       description:"HTML5 Introduction", 
       summary:"HTML5 Webinar", 
       startDate: new webapis.TZDate(2011, 3, 30, 10, 0), 
       duration: new webapis.TimeDuration(1, "HOURS"),
    To keep the example as simple as possible, the defined ev array includes only 1 event.
  3. Use the addBatch() method of the Calendar object to add the events in the array to the calendar: