Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CNContactStore.NewContact
Creates new empty contact.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Contacts | 8.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |
Parameters
none
Result
Returns contact identifier or error.
Description
Creates new empty contact.Please use later CNContactStore.AddContact to store changes.
Examples
Create a contact:
Set Variable [ $contactID ; Value: MBS( "CNContactStore.NewContact") ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "givenName"; "Joe" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "familyName"; "Miller" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "jobTitle"; "Family Manager" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "organization"; "Family" ) ]
#
#
Set Variable [ $image ; Value: MBS( "Container.ReadFile"; "/Library/Desktop Pictures/Lion.jpg") ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "imageData"; $image ) ]
#
Set Variable [ $r ; Value: MBS( "CNContact.AddEmailAddress"; $contactID; "test@test.test"; "Work" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddInstantMessage"; $contactID; "instantTest"; "Facebook"; "Work" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddURLAddress"; $contactID; "http://www.monkeybreadsoftware.com/"; "Homepage" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddSocialProfile"; $contactID; "Home"; "http://www.facebook.com"; "testSocial"; ""; "Facebook" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddRelation"; $contactID; "Jane Miller"; "Sister" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddPhoneNumber"; $contactID; "123 456 789"; "iPhone" ) ]
Set Variable [ $r ; Value: MBS( "CNContact.AddPostalAddress"; $contactID; "Home"; "Main Street 123"; "New City"; "NS"; "12345"; "USA"; "US" ) ]
#
Set Variable [ $contactID ; Value: MBS( "CNContactStore.AddContact"; $contactID) ]
If [ MBS("IsError") ]
Show Custom Dialog [ "Failed to create a contact" ; $r ]
Else
Set Field [ Contacts::ContactID ; $contactID ]
Set Variable [ $json ; Value: MBS( "CNContact.JSON"; $contactID) ]
Set Variable [ $json ; Value: MBS("JSON.Colorize"; MBS( "JSON.Format"; $json) ) ]
Set Field [ Contacts::Result ; $json ]
End If
See also
- CNContact.AddRelation
- CNContact.AddSocialProfile
- CNContact.AddURLAddress
- CNContactStore.AddContact
- CNContactStore.Contacts
- CNContactStore.DeleteContact
- CNContactStore.UpdateContact
- Container.ReadFile
- JSON.Colorize
- JSON.Format
Example Databases
This function checks for a license.
Created 2nd August 2018, last changed 6th August 2018
CNContactStore.GroupsInContainer - CNContactStore.RemoveMember