Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Sets the value of a given property for a record.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Addressbook | 3.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |
This function was deprecated. Use Contacts functions instead.
Parameter | Description | Example | Flags |
---|---|---|---|
RecordID | The unique ID for the target person or group. | $personID | |
PropertyName | The name of the property. | "EmailProperty" | |
Value | The value as text, date or number. | $value | Optional |
Returns OK on success and error on failure.
Set first name on a person:
MBS( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; Addressbook::FirstName )
Add a new URL to a contact:
Set Variable [$r; MBS( "Addressbook.multivalue.New") ]
Set Variable [$ID; MBS( "Addressbook.multivalue.addValue"; "http://www.mbsplugins.de"; "WorkLabel" ) ]
Set Variable [$r; MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $ID ) ]
Set Variabel [$r; MBS( "Addressbook.record.SetValueForProperty"; $personID; "URLsProperty"; "multivalue" ) ]
Add work and home emails:
$r = MBS( "Addressbook.multivalue.New" )
$WorkEmailID = MBS( "Addressbook.multivalue.addValue"; Addressbook::WorkEmail; "EmailWorkLabel" )
$HomeEmailID = MBS( "Addressbook.multivalue.addValue"; Addressbook::HomeEmail; "EmailHomeLabel" )
$r = MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $WorkEmailID )
$r = MBS( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "multivalue" )
Set flags, so entry shows as company:
MBS( "Addressbook.record.SetValueForProperty"; $personID; "PersonFlags"; 1 )
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" )
Replace an email:
# find my ID
Set Variable [$personID; Value:MBS( "Addressbook.me" )]
# get email list
Set Variable [$r; Value:MBS( "Addressbook.record.valueForProperty"; $personID; "EmailProperty" )]
# show first email in list
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# replace first email with new email
Set Variable [$r; Value:MBS( "Addressbook.multivalue.replaceValueAtIndex"; 0; "test@test.test" )]
# show changed email
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# set back the email list
Set Variable [$r; Value:MBS( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "" )]
# save it
Set Variable [$r; Value:MBS( "Addressbook.save" )]
Show Custom Dialog ["Saved"; $r]
Add first and last name:
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; $vn )]
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "LastNameProperty"; $nn )]
Set organization:
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "OrganizationProperty"; $org )]
Add homepage URLs:
# add homepages
Set Variable [ $r ; Value: MBS( "Addressbook.multivalue.New" ) ]
Set Variable [ $Blog_URL_ID ; Value: MBS( "Addressbook.multivalue.addValue"; "http://www.mbsplugins.de/"; "Blog" ) ]
Set Variable [ $Homepage_URL_ID ; Value: MBS( "Addressbook.multivalue.addValue"; "http://www.monkeybreadsoftware.com/"; "HomePageLabel" ) ]
Set Variable [ $r ; Value: MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $Homepage_URL_ID ) ]
Set Variable [ $r ; Value: MBS( "Addressbook.record.SetValueForProperty"; $personID; "URLsProperty"; "multivalue" ) ]
This function checks for a license.
Created 18th August 2014, last changed 25th January 2024
Addressbook.personFromVCardTextRepresentation - Addressbook.record.UniqueID