eon_cordova_contact object

This object allows you to access the device contacts database.

Functions

of_addcontactaddress

Description

Adds an address to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactaddress ( string as_type, string as_formatted, string as_streetaddress, string as_locality, string as_region, string as_postalcode, string as_country )

Parameter

as_type - A string indicating what type of field this is, home for example.

as_formatted - The full address formatted for display. It is unsupported on iOS.

as_streetaddress - The full street address.

as_locality - The city or locality.

as_region - The state or region.

as_postalcode - The zip code or postal code.

as_country - The country name.

Return value

None

of_addcontactemail

Description

Adds an email to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactemail ( string as_email, string as_emailtype, boolean abl_emailpref )

Parameter

as_email - Email address.

as_emailtype - Email type. Values: home, work, mobile, iPhone, or any other value that is supported by a particular device platform's contact database.

abl_emailpref - Whether used as the preference email. Values: true, false. It is unsupported on some platform.

Return value

None

of_addcontactname

Description

Adds a contact name to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactname ( string as_contactname, string as_givenname, string as_familyname, string as_middlename, boolean abl_pref )

Parameter

as_contactname - The contact's complete name you want to set.

as_givenname - The contact's first name you want to set.

as_familyname - The contact's last name you want to set.

as_middlename - The contact's middle name you want to set.

abl_pref - Whether used as the preference name. Values: true, false. It is unsupported on some platform.

Return value

None

of_addcontactorganization

Description

Adds an organization to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactorganization ( string as_name, string as_department, string as_title, string as_type )

of_addcontactorganization ( string as_name, string as_department, string as_title, string as_type, boolean abl_pref )

Parameter

as_name - The name of the organization.

as_department - The department the contact works for.

as_title - The contact's title at the organization.

as_type - A string that indicates what type of field this is, home for example.

abl_pref - Whether used as the preference organization. Values: true, false. It is unsupported on some platform.

Return value

None

of_addcontactphonenumber

Description

Adds a phone number to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactphonenumber ( string as_phonenumber, string as_phonetype, boolean abl_phonepref )

Parameter

as_phonenumber - Phone number.

as_phonetype - Phone number type. Values: home, work, mobile, iPhone, or any other value that is supported by a particular device platform's contact database.

abl_phonepref - Whether used as the preference number. It is unsupported on some platform.

Return value

None

of_addcontactphoto

Description

Adds a photo to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontactphoto ( string as_photopath, string as_phototype, boolean abl_photopref )

Parameter

as_photopath - Photo URL/path.

as_phototype - Format of the returned image: url (when the value attribute contains a URL to the photo image), or base64 (when the value contains a base64-encoded image string).

abl_photopref - Whether used as the preference photo. It is unsupported on some platform.

Return value

None

of_addcontacturls

Description

Adds a contact URL to the JSON node. It will be used when creating a new contact.

Syntax

of_addcontacturls ( string as_value, string as_type, boolean abl_pref )

Parameter

as_value - The URL to be added.

as_type - The type of the URL.

abl_pref - Whether used as the preference URL. It is unsupported on some platform.

Return value

None

of_associatejswithpb

Description

Associates the current PowerBuilder object with a JavaScript object.

Syntax

of_associatejswithpb ( string as_contactobjectname )

Parameter

as_contactobjectname - Name of the JavaScript object.

Return value

None

of_clear_jsonarray

Description

Clears the values of the JSON array.

Syntax

of_clear_jsonarray ( eon_cjsonnodearray aeon_cjsonarray )

Parameter

eon_cjsonnodearray - Name of the JSON array.

Return value

None

of_create

Description

Creates a new contact and saves the contact to the device contacts database.

The contact information will be returned as a JSON string to the parameter of the oe_success event.

Syntax

of_create ( string as_contactname, eon_str_cordova_contact_name astr_contact_name, eon_str_cordova_contact_address astr_address[], eon_str_cordova_contact_organization astr_organization[], eon_str_cordova_contact_urls astr_urls[], eon_str_cordova_contact_field astr_phone[], eon_str_cordova_contact_field astr_email[], string as_note )

of_create ( string as_contactname, string as_givenname, string as_familyname, string as_middlename, string as_phonenumber, string as_phonenumbertype, string as_email, string as_emailtype )

of_create ( string as_contactname, string as_phonenumber )

of_create ( string as_contactname, string as_phonenumber, string as_phonenumbertype, string as_email, string as_emailtype )

Parameter

as_contactname - Name of the new contact.

astr_contact_name - Structure for the contact name information such as first name, last name, middle name etc.

astr_address[] - Structure array for the contact address information such as multiple addresses.

astr_organization[] - Structure array for the contact organization information such as multiple organizations.

astr_urls[] - Structure array for the contact URL such as multiple URLs.

astr_phone[] - Structure array for the contact phone number such as smart phone number, home phone number etc.

astr_email[] - Structure array for the contact email such as multiple email addresses.

as_note - Note of the new contact.

as_givenname - First name of the new contact.

as_familyname - Last name of the new contact.

as_middlename - Middle name of the new contact.

as_phonenumber - Phone number of the new contact.

as_phoneNumberType - Phone number type. Values: home, work, fax, mobile.

as_email - Email address of the new contact.

as_emailType - Email type of the new contact.

Return value

String.

0: Success

error text: Error returned when failing to create the contact.

of_create_jsonpar

Description

Creates a contact using a JSON-format string and saves the information.

The contact information will be returned as a JSON string to the parameter of the oe_success event.

Syntax

of_create_jsonpar ( string as_contact_infor )

Parameter

as_contact_infor - A JSON-format string that contains the contact information.

Return value

String.

0: Success

error text: Error returned when failing to create the contact.

of_delete

Description

Deletes the contact according to the specified name or phone number.

Syntax

of_delete ( string as_nameorphone )

Parameter

as_nameorphone - Name or phone number of the contact to be deleted. If there are multiple contacts found, only the first one on the list will be deleted.

Return value

Integer.

1 - Success.

-1 - Failure (due to errors or other problems, or failing to find the contact).

0 - Not found.

of_delete_contactid

Description

Deletes the contact according to the specified contact ID.

Syntax

of_delete_contactid ( string as_id )

Parameter

as_id - The unique ID of the contact to be deleted.

Return value

Integer.

1 - Success.

-1 - Failure (due to errors or other problems, or failing to find the contact).

0 - Not found.

of_destroy_object

Description

Destroys the JSON object.

Syntax

of_destroy_object ( )

Return value

None

of_find

Description

Finds a contact.

Syntax 1

of_find ( string as_contactfield, string as_contactopt_filter, boolean abl_contactopt_multiple, string as_contactopt_desiredfields, boolean abl_contactopt_hasphonenumber )

Parameter 1

as_contactfield - The contact fields used as a search qualifier.

as_contactopt_filter - The search string used to find navigator.contacts.

abl_contactopt_multiple - Whether the find operation returns multiple navigator.contacts (default: false).

as_contactopt_desiredfields - The contact fields to be returned. If specified, the returned result only contains values for these fields.

abl_contactopt_hasphonenumber - Search only returns contacts with a phone number. It is supported on Android only.

Return value 1

String. Returns a JSON-format string with the found contacts.

Syntax 2

of_find ( string as_contactopt_filter )

Parameter 2

as_contactopt_filter - The search string used to find navigator.contacts.

Return value 2

Any. eon_str_cordova_contact_find[]: if successful, the structure stores the contact name, ID, note, URL, phone number, email, address, organization, and photo; if not found, eon_str_cordova_contact_find.s_errortext = notfind; if error occurs, eon_str_cordova_contact_find.s_errortext = error.

of_find_contactname

Description

Finds a contact's name, ID, display name, and nick name.

Syntax

of_find_contactname ( string as_contactopt_filter )

Parameter

as_contactopt_filter - The search string used to find navigator.contacts.

Return value

Any. eon_str_cordova_contact_find[]: if successful, the structure stores the contact name, phone number, email, address, organization, and photo; if not found, eon_str_cordova_contact_find.s_errortext = notfind; if error occurs, eon_str_cordova_contact_find.s_errortext = error.

of_find_event

Description

Finds a contact. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered; and the return value will be passed to the parameter of the event.

Syntax

of_find_event ( string as_contactfield, string as_contactopt_filter )

of_find_event ( string as_contactfield, string as_contactopt_filter, boolean abl_contactopt_multiple, string as_contactopt_desiredfields, boolean abl_contactopt_hasphonenumber )

of_find_event ( string as_contactfield, string as_contactopt_filter, string as_contactopt_desiredfields )

Parameter

as_contactfield - The contact fields used as a search qualifier.

as_contactopt_filter - The search string used to find navigator.contacts.

abl_contactopt_multiple - Whether the find operation returns multiple navigator.contacts (default: false).

as_contactopt_desiredfields - The contact fields to be returned. If specified, the returned result only contains values for these fields.

abl_contactopt_hasphonenumber - Search only returns contacts with a phone number. It is supported on Android only.

Return value

None.

of_getcontactfieldtype

Description

Gets the contact field type. This can get all of the properties of a contact.

Syntax

of_getcontactfieldtype ( )

Return value

String.

of_getphoto_android

Description

Gets the photo from the device's contact database and creates a copy under the Appeon application folder.

Supported on Android only.

Syntax

of_getphoto_android ( string as_photo )

Parameter

as_photo - The photo in the device's contact database (obtained from eon_str_cordova_contact_find[]).

Return value

String. The directory of the photo in the plugin folder of the Appeon application.

of_init

Description

Connects with the Cordova contacts plugin, detects if the plugin is available to call, and binds the current PowerBuilder object with the JavaScript object defined by the plugin. After that, the PowerBuilder object has all of the methods and properties that the JavaScript object has.

Syntax

of_init ( )

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_init_jsonobject

Description

Creates a JSON object, to help add the contact's property.

Syntax

of_init_jsonobject ( )

Return value

None.

of_remove

Description

Deletes a contact. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered; and the return value will be passed to the parameter of the event.

Syntax

of_remove ( string as_contact_id )

Parameter

as_contact_id - ID of the contact that you want to remove.

Return value

None.

of_save

Description

Saves the newly created contact to the device. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered; and the return value will be passed to the parameter of the event.

Syntax

of_save ( string as_contactobjectname )

Parameter

as_contactobjectname - Name of the contact object.

Return value

None.

of_setcontactaddress

Description

Creates a contactaddress JSON node and sets the value.

Syntax

of_setcontactaddress ( string as_type, string as_formatted, string as_streetaddress, string as_locality, string as_region, string as_postalcode, string as_country )

Parameter

as_type - A string indicating what type of field this is, home for example.

as_formatted - The full address formatted for display.

as_streetaddress - The full street address.

as_locality - The city or locality.

as_region - The state or region.

as_postalcode - The zip code or postal code.

as_country - The country name.

Return value

eon_cjsonnode. The JSON node with the values.

of_setcontactfield

Description

Creates a contactfield JSON node and sets the value.

Syntax

of_setcontactfield ( string as_value )

of_setcontactfield ( string as_value, string as_type, boolean abl_pref )

Parameter

as_value - The value of the field, such as a phone number or email address.

as_type - In most instances, there are no pre-determined values for this parameter. For example, a phone number can specify type values of home, work, mobile, iPhone, or any other value that is supported by a particular device platform's contact database. However, for the Contact photos field, the type indicates the format of the returned image: url when the value attribute contains a URL to the photo image, or base64 when the value contains a base64-encoded image string.

abl_pref - Whether used as the preference value. It is unsupported on some platform.

Return value

eon_cjsonnode. The JSON node with the values.

of_setcontactname

Description

Sets the contact's name.

Syntax 1

of_setcontactname ( string as_contactname )

Parameter 1

as_contactname - The contact's name you want to set.

Return value 1

None.

Syntax 2

of_setcontactname ( string as_givenname, string as_familyname, string as_formatted, string as_middlename, string as_honorificprefix, string as_honorificsuffix, boolean abl_pref )

Overloads the of_setcontactname function for adding the other name related information.

Parameter 2

as_givenname - The contact's first name you want to set.

as_familyname - The contact's last name you want to set.

as_formatted - The contact's complete name you want to set.

as_middlename - The contact's middle name you want to set.

as_honorificprefix - The contact's prefix (example Mr. or Dr.)

as_honorificsuffix - The contact's suffix (example Esq.).

abl_pref - Whether used as the preference name. Values: true, false. It is unsupported on some platform.

Return value 2

eon_cjsonnode. Returns the JSON node with the values.

of_setcontactoptions

Description

Sets the options' value for the find parameter.

Syntax

of_setcontactoptions ( string as_contactopt_filter, boolean abl_contactopt_multiple, string as_contactopt_desiredfields, boolean abl_contactopt_hasphonenumber )

Parameter

as_contactopt_filter - The string used to find navigator.contacts.

abl_contactopt_multiple - Whether the find operation returns multiple navigator.contacts (default: false).

as_contactopt_desiredfields - Contact fields to be returned.

abl_contactopt_hasphonenumber - (Android only) Search only returns contacts with a phone number (default: false).

Return value

String. Returns the JSON string with the options.

of_setcontactorganization

Description

Creates a contactorganization JSON node and sets the value.

Syntax

of_setcontactorganization ( string as_name, string as_department, string as_title, string as_type )

Parameter

as_name - The name of the organization. It is partially supported on iOS.

as_department - The department the contact works for. It is partially supported on iOS.

as_title - The contact's title at the organization. It is partially supported on iOS.

as_type - A string that indicates what type of field this is, home for example. It is unsupported on iOS.

Return value

eon_cjsonnode. The JSON node with the values.

Properties

eon_cjsonnode iec_contactname

The JSON node object for adding the contact's name.

eon_cjsonnode iec_contactpro

The JSON node object for adding the contact's properties.

eon_cjsonnodearray iec_addressarray

The JSON array object for adding the address information.

eon_cjsonnodearray iec_emailsarray

The JSON array object for adding the email information.

eon_cjsonnodearray iec_organizationarray

The JSON array object for adding the organization information.

eon_cjsonnodearray iec_phonenumberarray

The JSON array object for adding the phone number information.

eon_cjsonnodearray iec_photoarray

The JSON array object for adding the photo information.

eon_cjsonnodearray iec_urlsarray

The JSON array object for adding the URL.

oleobject ieon_ole

PowerBuilder OLEObject object to be connected with the Cordova plugin.

powerobject ipo_bindevent

PowerBuilder object to be bound with the JavaScript object.

string is_errorevent

Stores the error event name of the PowerBuilder object.

string is_errortext

Stores the error information returned by the JavaScript function when execution failed.

string is_jserrortext

Stores the JavaScript error information when JavaScript call fails.

string is_navigatorcontacts

Stores the object name of the Contact plugin.

string is_successevent

Stores the success event name of the PowerBuilder object.

string is_successtext

Stores the value returned by the JavaScript function when execution is successful.

Structures

eon_str_cordova_contact_address

Description

Struct.

Stores the information of the contact address.

Property

Type

Variable Name

Description

string

s_type

Type of the field, home for example.

string

s_streetaddress

The street address.

string

s_locality

The city or locality.

string

s_region

The state or region.

string

s_postalcode

The zip code or postal code.

string

s_country

The country name.

string

s_formatted

The complete address.
eon_str_cordova_contact_field

Description

Struct.

Stores the information of the contact field.

Property

Type

Variable Name

Description

string

s_type

Type of the contact field.

string

s_value

Value of the contact field.

eon_str_cordova_contact_find

Description

Struct.

Stores the information of the found contact.

Property

Type

Variable Name

Description

string

s_contactname

Name of the found contact.

string

id

Unique ID of the found contact.

eon_str_cordova_contact_field

str_phonenumbers[]

Phone numbers of the found contact.

eon_str_cordova_contact_field

str_emails[]

Emails of the found contact.

string

s_photos[]

Photos of the found contact.

eon_str_cordova_contact_address

str_address[]

Address of the found contact.

eon_str_cordova_contact_organization

str_organizations[]

Organization of the found contact.

string

s_errortext

Error text.

date

d_birthday

Birthday of the found contact.

eon_str_cordova_contact_name

str_contactname

Name of the found contact.

string

s_note

Note of the found contact.

eon_str_cordova_contact_urls

str_urls[]

URLs of the found contact.
eon_str_cordova_contact_name

Description

Struct.

Stores the information of the contact name.

Property

Type

Variable Name

Description

string

s_givenname

First name of the contact.

string

s_formatted

Complete name of the contact.

string

s_middleName

Middle name of the contact.

string

s_familyname

Last name of the contact.

string

s_honorificPrefix

Prefix (such as Mr. or Dr.) of the contact.

string

s_honorificSuffix

Suffix (such as Esq.) of the contact.
eon_str_cordova_contact_organization

Description

Struct.

Stores the information of the contact organization.

Property

Type

Variable Name

Description

string

s_name

The name of the organization.

string

s_department

The department the contact works for.

string

s_title

The contact's title at the organization.

string

s_type

Type of the field, home for example.

eon_str_cordova_contact_urls

Description

Struct.

Stores the information of the contact URL.

Property

Type

Variable Name

Description

string

s_value

The URL.

string

s_type

The type of the URL.