Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  

Addressbook.addRecord

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

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Addressbook 3.1 Yes No Yes, macOS only No Yes

MBS( "Addressbook.addRecord"; RecordID )

Parameters

Parameter Description Example value
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.

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


Addressbook.Record.Account   -   Addressbook.allAccounts

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins