6.3.5 Export

Export is used to export the calendar entries to an output file. The information is exported to an ICal or VCal file. This method can be called both in synchronous and asynchronous mode.

The following are the examples for using Export:


calendar_handle.call('Export', {'Type': u'CalendarEntry', 'FileName': u'C:\\Data\\output.txt', 'Format': u'VCal'})


calendar_handle.call('Export', {'Type': u'CalendarEntry', 'FileName': u'C:\\data\\output.txt', 'Format': u'VCal'}, callback= exp_callback))

where, exp_callback is an user defined callback function.

The following table summarizes the specification of Export:

Interface IDataSource
Description Exports the calendar entries to an output file.
Response Model Synchronous and asynchronous
Pre-condition IDataSource interface is loaded.
Post-condition Nil
Note The specified calendar must exist.

Input Parameters

Input parameter specifies the Type and its details to export. Input parameter properties are Type and Data.

Table 6.48: Input parameters Export
Name Type Range Description
Type unicode string CalendarEntry Performs the operation on calendar entries.
Data map [CalendarName]: unicode string
Idlist or LocalIdList: List of unicode strings
FileName: unicode string
Format: unicode string
Exports entries to the default calendar if not specified. CalendarName must be in the format Drivexxx:FileNamexxx.

Exports entries in the given format. Format can have values ICal or VCal. ICal is supported from Fifth Edition devices onwards.

IdList or LocalIdList is a list of Ids of the entries to be exported. Specify either IdList or LocalIdList. It exports all the entries from the specified calendar file if the list is not specified. Also, it exports only for valid Ids and ignores the remaining Ids.

Entries are exported to the file if FileName is specified else, 8-bit Data is returned as output.

Output Parameters

Output contains the requested information ReturnValue. It also contains ErrorCode, and an ErrorMessage, if the operation fails.

Table 6.49: Output parameters Export
Name Type Range Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.
ReturnValue (Applicable in case FileName is not specified in data) 8-bit data NA Contains the exported entries in the specified format. It is applicable if FileName is not specified in input parameters.


The following table lists the errors and their values:

Table 6.50: Error codes
Error code value Description
1000 Invalid service argument
1004 Service not supported

Error Messages

The following table lists the error messages and their description:

Table 6.51: Error messages
Error messages Description
Calendar:Export:Type is invalid Export called with invalid Type
Calendar:Export:Data is missing Export called without passing input Data
Calendar:Export:Data is invalid Invalid type is passed for input Data parameter
Calendar:Export:Format is missing Export Format not passed in Data.
Calendar:Export:FileName is invalid Invalid type for FileName parameter or, FileName exceeds 239 characters
Calendar:Export:IdList is invalid Invalid type for input IdList parameter
Calendar:Export:LocalIdList is invalid Invalid type for input LocalIdList parameter
Calendar:Export:CalendarName is invalid Invalid type is passed for CalendarName


The following sample illustrates how to export a calendar entry:

# Load Calendar service
calendar_handle = scriptext.load('Service.Calendar', 'IDataSource')

    calendar_handle.call('Export', {'Type': u'CalendarEntry', 'FileName': u'C:\\Data\\importfile.txt', 'Format': u'VCal' })
except scriptext.ScriptextError:
    print 'Error in servicing the request'
    print "Export request successfully complete!"

See About this document... for information on suggesting changes.