Samsung Electronics logo

Managing a Single Calendar Event



To create engaging applications with various calendar features, you must learn to manage a single calendar event:

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

    With the parameter, specify the calendar type as an event.

    myCalendar = webapis.calendar.getDefaultCalendar("EVENT");
    
  2. Retrieve all events stored in the calendar by using the find() method of the Calendar object:

    myCalendar.find(eventSearchSuccessCallback, errorCallback);
    Note
    To retrieve a specific set of events, you can specify a filter and sorting order for the search operation through the filter and sortMode parameters (for attributes supported in the filter, see Calendar Filter Attributes).

    In this example, all the events are retrieved because no filter is used.

  3. Update or delete the found item inside the eventSearchSuccessCallback event handler.

    In this example, the description parameter of the first event is changed and the event is updated in the calendar using the update() method. The second event is deleted using the remove() method.

    /* Define the event success callback */
    function eventSearchSuccessCallback(events) 
    {
       /* Update the first existing event */
       events[0].description = "New Description";
       myCalendar.update(events[0]);
    
       /* Delete the second existing event */
       myCalendar.remove(events[1].id);
    }