Delete()

Description:

The Delete method deletes a calendar from the device or one or more entries from a calendar. Entries are deleted from the specified calendar or, if no calendar is specified, from the default one.

For deleting a calendar, this method is called synchronously. For deleting calendar entries, this method can be called both synchronously and asynchronously.

Syntax:

For synchronous calls:

Delete(parameters:Object):Object

For asynchronous calls:

Delete(parameters:Object, callback:Object):Object

Arguments:

  • parameters:

    This is an object that specifies which calendar or calendar entries to delete. For more information about the object properties and how to define them, see section Parameters for deleting calendar information.

  • callback:

    The callback argument is the name of the method that is executed when an asynchronous Delete call has results or status information to return. You must define this method separately. Follow the instructions in section Defining the callback handler for an asynchronous method to define the callback method.

    This argument is used only with an asynchronous Delete call.

Return value:

If synchronous, the Delete method returns an object that contains an error code and an error message.

If asynchronous, the method returns an object that contains a transaction ID for the callback instance, an error code, and an error message. When the asynchronous call has completed, callback returns an object that contains an error code and an error message (see Table: Callback return value).

Table: Return value properties for Delete

Property

Description

Value

TransactionID

This is a number used as an identification to match transactions started with an asynchronous Delete call to one or more calls it generates to callback.

This property is only valid for asynchronous calls.

 

ErrorCode

This is a number that specifies a predefined error code.

See Service API error codes.

ErrorString

This is a text string that describes the error.

Remarks:

  • The default calendar cannot be deleted.

  • To delete a calendar or entries from a calendar, the corresponding calendar file must exist on the device.

Example code:

The following sample code illustrates how to delete a calendar entry synchronously:

import com.nokia.lib.Service;
var calender = new Service("Service.Calendar", "IDataSource");
var idList = ["id1","id2",..."idn"];
var inputData = {IdList:idList};
var inParams = {Type:"CalendarEntry", Data:inputData};
var outParams = calender.Delete(inParams);
var errorId = outParams.ErrorCode;

The following sample code illustrates how to delete a calendar entry asynchronously:

import com.nokia.lib.Service;
var calender = new Service("Service.Calendar", "IDataSource");
var idList = ["id1","id2"..."idn"];
var inputData = {IdList:idList};
var inParams = {Type:"CalendarEntry", Data:inputData};
calender.Delete(inParams, onDelete);
function onDelete(transactionID:Number, eventID:String, outParam:Object) {
var errorcode = outParam.ErrorCode;}