IDataSource.GetList()

Description:

The GetList method retrieves a list of contacts, contact groups, or contacts databases. Contacts and contact groups are retrieved from the specified contacts database or, if no database is specified, from the default one.

This method can be called both synchronously and asynchronously.

Note: Calls that retrieve a list of databases must always be synchronous.

Syntax:

For synchronous calls:

result = so.IDataSource.GetList(criteria);

For asynchronous calls:

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

Arguments:

  • criteria:

    This is an object that specifies what contact information is returned and how the returned information is sorted. For more information about the object properties and how to define them, see section Criteria for retrieving contact information.

  • callback:

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

Return value:

If synchronous, the GetList method returns an object that contains the requested contact information, an error code, and an error message.

Table: Return value properties for a synchronous GetList

Property

Description

Value

result.ReturnValue

This is an iterator that contains the requested contact information.

See Returned contact information.

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 Contacts Service API error messages.

If asynchronous, the GetList method returns an object that contains the initial return value for the asynchronous call it started (see the following table). The actual contact information is returned by the callback method in the ReturnValue property of its result object. The returned information is described in section Returned contact information.

Table: Return value properties for an asynchronous GetList

Property

Description

Value

result.TransactionID

This is a number used as an identification to match transactions started with the asynchronous GetList 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 Contacts Service API error messages.

Remarks:

The default contacts database is cntdb://c:contacts.cdb. The SIM card database is sim://global_adn.

Example code:

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