Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Addressbook.addRecord

Adds an person or group record to the Address Book database.

Component Version macOS Windows Linux Server iOS SDK
Addressbook 3.1 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes

Deprecated

This function was deprecated. Use Contacts functions instead.

MBS( "Addressbook.addRecord"; RecordID )   More

Parameters

Parameter Description Example
RecordID The unique ID for the target person or group. $personID

Result

Returns OK or error message.

Description

Adds an person or group record to the Address Book database.
You may want to call Addressbook.save later to saves changes permanently.

Examples

Create person and save changes:

$personID = MBS( "Addressbook.NewPerson" )
$r = MBS( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; "John" )
$r = MBS( "Addressbook.addRecord"; $personID )
$r = MBS( "Addressbook.save" )

Add a new person to addressbook.

# Fields to variables
#
Set Variable [$vn; Value:Adressen::Extra]
Set Variable [$nn; Value:Adressen::Nachname]
Set Variable [$org; Value:Adressen::Name]
Set Variable [$str; Value:Adressen::Straße]
Set Variable [$land; Value:Adressen::Land]
Set Variable [$plz; Value:Adressen::PLZ]
Set Variable [$ort; Value:Adressen::Stadt]
Set Variable [$email; Value:Adressen::EMail]
Set Variable [$tel; Value:Adressen::Tel]
Set Variable [$mob; Value:Adressen::Mobil]
#
# Create new person
#
Set Variable [$personID; Value:MBS ( "Addressbook.NewPerson" )]
# Add first name
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; $vn )]
# Add last name
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "LastNameProperty"; $nn )]
# Organization
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "OrganizationProperty"; $org )]
# Add one address
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.New"; 1 )
Set Variable [$id; Value:MBS ( "Addressbook.multivalue.addAddress"; $str; $plz; $ort; $land; ""; "" )]
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.setPrimaryIdentifier"; $id )]
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "AddressProperty"; "multivalue" )]
# add an email
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.New")
Set Variable [$id; Value:MBS ( "Addressbook.multivalue.addValue"; $email; "EmailWorkLabel" )]
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.setPrimaryIdentifier"; $id )]
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "multivalue" )]
# Add phone numbers
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.New"]
Set Variable [$tel_id; Value:MBS ( "Addressbook.multivalue.addValue"; $tel; "PhoneWorkLabel" )]
Set Variable [$mob_id; Value:MBS ( "Addressbook.multivalue.addValue"; $mob; "PhoneMobileLabel" )]
Set Variable [$result; Value:MBS ( "Addressbook.multivalue.setPrimaryIdentifier"; $mob_id )]
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "PhoneProperty"; "multivalue" )]
#
# Save record
Set Variable [$result; Value:MBS ( "Addressbook.addRecord"; $personID )]
Set Variable [$result; Value:MBS ( "Addressbook.save" )]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 24th September 2019


Addressbook.Record.Account - Addressbook.allAccounts