Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Addressbook.NewPerson
Creates a new person.
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 ID for new person.
Description
Creates a new person.This person has no ID assigned until you save it to the addressbook. So the plugin returns a special ID where the plugin knows that when you change the person, you refer to the new person.
Address book item reference numbers are starting at 26000 and counting up for each new item.
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
- Addressbook.addRecord
- Addressbook.multivalue.addAddress
- Addressbook.multivalue.addValue
- Addressbook.multivalue.New
- Addressbook.multivalue.setPrimaryIdentifier
- Addressbook.NewGroup
- Addressbook.record.SetValueForProperty
- Addressbook.record.UniqueID
- Addressbook.save
Example Databases
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 18th October 2016
