Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Addressbook.save
Saves all the changes made since the last save.
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.
Parameters
none
Result
Returns OK on success and error on failure.
Description
Saves all the changes made since the last save.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" )
Edit existing person:
# get an UUID for a person record
$personID = "637FA922-7A2B-4F9A-BFA3-023253D4A3D5:ABPerson"
# set a new name
$r = MBS( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; "John" )
# save it
$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
- Addressbook.addRecord
- Addressbook.group.addMember
- Addressbook.me
- Addressbook.multivalue.addAddress
- Addressbook.multivalue.addValue
- Addressbook.multivalue.New
- Addressbook.multivalue.replaceValueAtIndex
- Addressbook.multivalue.setPrimaryIdentifier
- Addressbook.record.SetValueForProperty
- Addressbook.removeRecord
Example Databases
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 18th October 2016
Addressbook.removeRecord - Addressbook.searchElementForConjunction