IDataSource.Export()

Description:

The Export method exports entries from a calendar. The information is exported to an iCal or vCal file. For more information about these two formats, see the Calendar Service overview page.

This method can be called both synchronously and asynchronously.

Syntax:

For synchronous calls:

result = so.IDataSource.Export(criteria);

For asynchronous calls:

result = so.IDataSource.Export(criteria, callback);

Arguments:

  • criteria:

    This is an object that specifies the entries to export and optionally the source calendar. For more information about the object properties and how to define them, see section Criteria for exporting calendar entries.

  • callback:

    The callback argument is the name of the method that is executed when an asynchronous Export 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 Export call.

Return value:

If synchronous, the Export method returns an object that contains an error code, an error message, and optionally the exported calendar entries.

Table: Return value properties for a synchronous Export

Property

Description

Value

[result.ReturnValue]

This is a text string that contains the exported entries in the specified format.

This property is only included if Data.FileName was not specified in the input. This property serves as a buffer that contains the same data as the target file would have had it been specified.

 

result.ErrorCode

This is a number that specifies a predefined error code.

See Service API error codes.

result.ErrorMessage

This is a text string that describes the error.

See Calendar Service API error messages.

If asynchronous, the Export method returns an object that contains a transaction ID for the callback instance, an error code, and an error message (see the following table). When the asynchronous call has completed, callback returns an object that contains an error code, an error message, and optionally the exported calendar entries (see the preceding table).

Table: Return value properties for an asynchronous Export

Property

Description

Value

result.TransactionID

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

 

result.ErrorCode

This is a number that specifies a predefined error code.

See Service API error codes.

result.ErrorMessage

This is a text string that describes the error.

See Calendar Service API error messages.

Remarks:

  • The calendar file from which the entries are exported must exist on the device.

  • For detailed information about calendar entries, see section Calendar entries.

Example code:

For the complete source of a sample widget that demonstrates how to use this Service API, see the full example.