Add
is used to create a new calendar on the device, add an entry to a calendar, or modify the entry if an entry with the same LocalId
already exists in the calendar. The entry is added to the specified calendar or, if no calendar is specified, to the default one. In case the default calendar does not exist, it is created. It is available only in synchronous mode.
The following is an example for using Add
:
calendar_handle.call('Add', {'Type': u'CalendarEntry', 'Item': {'Description': u'This is the meeting description', 'StartTime', start_time, 'EndTime', end_time}}) where start_time and end_time are datetime objects.
The following table summarizes the specification of Add
:
Interface | IDataSource |
Description | Adds a new calendar in the device or a new entry in a specific calendar file. |
Response Model | Synchronous |
Pre-condition | IDataSource interface is loaded. For updating a specific entry, the Id must exist and can be retrieved by a call to Add or GetList . |
Post-condition | Nil |
Input Parameters for Calendar
Input parameter specifies the details of a new calendar. Input parameter has two properties: Type, and Item.
|
Output Parameters for Calendar
Output parameter contains an error code and an optional error message if the operation fails.
|
Input Parameters for Calendar Entry
Add
performs add or update operations depending on the input parameters of Calendar Entry. Input parameters differ based on the Entry Type (Meeting
, To-Do
, Reminder
, DayEvent
, Anniversary
).
|
Output Parameters for Calendar Entry
Output parameter contains the requested information, an ErrorCode
, and an ErorrMessage
if the operation fails.
|
Input Parameters for Update
Input parameter specifies the type on which an operation is performed and the details of the particular Type.
|
Output Parameters for Update
Output parameter contains the Id
of the new entry added, ErrorCode
, and an ErrorMessage
, if the operation fails.
|
Errors
The following table lists the errors and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to add a calendar entry:
import scriptext import datetime # Load Calendar service calendar_handle = scriptext.load('Service.Calendar', 'IDataSource') start_time = datetime.datetime(2009,03,12,17,0,0) end_time = datetime.datetime(2009,03,12,18,0,0) try: calendar_handle.call('Add', {'Type': u'CalendarEntry', 'Item': {'Type': u'Meeting', 'Description': u'This is the meeting description', 'StartTime': start_time, 'EndTime': end_time}}) except scriptext.ScriptextError: print 'Error in servicing the request' else: print "Add request successfully complete!"
See About this document... for information on suggesting changes.