Delete is used to remove a calendar from the device or, one or more entries from a calendar. Entries are deleted from the specified calendar or, from the default one if no calendar is specified. You can delete a calendar in synchronous mode. You can delete calendar entries both in synchronous and asynchronous mode.
The following are the examples for using Delete:
Synchronous
event_id = calendar_handle.call('Delete', {'Type': u'CalendarEntry', 'id': del_id_list})
Asynchronous
event_id = calendar_handle.call('Delete', {'Type': u'CalendarEntry', 'id': del_id_list}, callback= del_callback)
where del_callback is a user defined callback function.
The following table summarizes the specification of Delete:
| Interface | IDataSource |
| Description | Deletes the specified calendar from the Device or, one or more entries / instances from a specific calendar file. |
| Response Model | Synchronous for type Calendar and both synchronous and asynchronous for type CalendarEntry. |
| Pre-condition | IDataSource interface is loaded. |
| Post-condition | Nil |
Input Parameters for Calendar
Input parameter specifies the type on which the operation is performed and the details of the particular type.
|
Output Parameters for Calendar
Output parameter contains ErrorCode and an optional ErrorMessage, which is displayed when the operation fails.
|
Input Parameters for Calendar Entry
Input parameter specifies the type on which the operation is performed and the details of the particular type.
|
Output Parameters for Calendar Entry
Output parameter contains ErrorCode, and an ErrorMessage, which is displayed when the operation fails.
|
Errors
The following table lists the errors and their values:
|
Error Messages
The following table lists the errors messages and their description:
|
Example
The following sample code illustrates how to delete a specified calendar entry in asynchronous mode:
import scriptext
import e32
# Using e32.Ao_lock() so that the main function can wait
# till the callback is hit.
lock = e32.Ao_lock()
# Callback function will be called when the requested service is complete
def del_callback(trans_id, event_id, input_params):
if event_id != scriptext.EventCompleted:
# Check the event status
print "Error in the operation"
print "Error code is: " + str(input_params["ReturnValue"]["ErrorCode"])
if "ErrorMessage" in input_params["ReturnValue"]:
print "Error message is: " + input_params["ReturnValue"]["ErrorMessage"]
elif event_id == scriptext.EventCompleted:
print "Entry deleted successfully."
lock.signal()
# Returns the list of calendar id's that needs to be deleted.
del_id_list = get_cal_del_id()
# Load Calendar service
calendar_handle = scriptext.load('Service.Calendar', 'IDataSource')
event_id = calendar_handle.call('Delete', {'Type': u'CalendarEntry', 'IdList': del_id_list}, callback=del_callback)
print "Waiting for the request to be processed!"
lock.wait()
print "Request complete!"
See About this document... for information on suggesting changes.