Calendar
From WebOS101
Contents |
Introduction
The Calendar service allows you to add events to the Palm calendar as well as look up calendar events created by your application. As a security 'feature' apps cannot currently access events created by other applications. To enforce the limitations on accessing information created by other applications you must first use the accounts service to create a unique identifier for your app.
Using the Service
Calling the Service
As with all service requests you must call the serviceRequest function, passing it the required parameters and two callback functions. These functions will be called on completion of the event. Be sure to bind the events to your class.
this.controller.serviceRequest('palm://com.palm.calendar/crud', {
method: 'calendarMethod',
parameters: {
callingProperty: value
},
onSuccess: myCallback,
onFailure: myFailureCallback
});
Objects
Several objects are consumed by and/or returned by the calendar service. They are:
Methods
Whenever you make a call to the calendar service you must specify which method to execute. The following methods are defined for the calendar:
- createCalendar
- getCalendar
- listCalendars
- updateCalendar
- deleteCalendar
- createEvent
- getEvent
- listEvents
- updateEvent
- deleteEvent
- startTracking
- getChanges
- doneWithChanges
Paremeters
Every function requires parameters and every function will require at least the unique identifier created for your app. Click on the methods above for a description of the required and optional parameters as well as the return values. Here's an example call to the createCalendar function with the appropriate parameters:
this.controller.serviceRequest('palm://com.palm.calendar/crud', {
method: 'createCalendar',
parameters: {
"accountId": this.acctid,
"calendar": {
"name":'MyApp'
}
},
onSuccess: this.CreateCalendarSuccessful.bind(this),
onFailure: this.CreateCalendarFailure.bind(this)
});

