Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

CNContactStore.AddContact

Adds a new contact to the database.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Contacts 8.4 Yes No No No Yes
MBS( "CNContactStore.AddContact"; ContactIdentifier { ; ContainerIdentifier } )   More

Parameters

Parameter Description Example value
ContactIdentifier The contact identifier. "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E"
ContainerIdentifier Optional
The identifier for the container.
"9892A5CC-964E-497A-B877-A47619F7493C:ABAccount"

Result

Returns OK or error.

Description

Adds a new contact to the database.
Optionally pass in container identifier to specify which account to use.

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

Example Databases

Created 1st August 2018, last changed 6th August 2018


CNContact.Value   -   CNContactStore.AddGroup

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins