CNContact.AddRelation
---------------------

Adds an relation to a contact.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Contacts](component_Contacts.md) | [8.4](newinversion84.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "CNContact.AddRelation"; ContactIdentifier; Name; Label ) 

**MBS**( **"CNContact.AddRelation";** /\* Adds an relation to a contact. \*/  
**$ContactIdentifier**; /\* The contact identifier.e.g. "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E" \*/   
**$Name**; /\* The name to use.e.g. "Christian Schmitz" \*/   
**$Label**) /\* The label to use.  
For your convenience we translate Assistant, Brother, Child, Daughter, Father, Friend, Manager, Mother, Parent, Partner, Sister, Son and Spouse to the right values, so they get localized in display.  
Default label is Other.e.g. "Dad" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ContactIdentifier | The contact identifier. | "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E" |
| Name | The name to use. | "Christian Schmitz" |
| Label | The label to use.   For your convenience we translate Assistant, Brother, Child, Daughter, Father, Friend, Manager, Mother, Parent, Partner, Sister, Son and Spouse to the right values, so they get localized in display.   Default label is Other. | "Dad" |

### Result

Returns OK or error.

### Description

Adds an relation to a contact.  
This is a convenience function to add just one relation with a given label to the contact.  
Please call [CNContactStore.UpdateContact](CNContactStoreUpdateContact.md) later to store the values.  
### See also

- [CNContact.AddEmailAddress](CNContactAddEmailAddress.md)
- [CNContact.AddInstantMessage](CNContactAddInstantMessage.md)
- [CNContact.AddPhoneNumber](CNContactAddPhoneNumber.md)
- [CNContactStore.AddContact](CNContactStoreAddContact.md)
- [CNContactStore.NewContact](CNContactStoreNewContact.md)
- [CNContactStore.UpdateContact](CNContactStoreUpdateContact.md)

### Example Databases

- [Mac and iOS/Contacts/Contacts](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Contacts/Contacts.shtml#7ScriptAnchor_)

Created 1st August 2018 , last changed 2nd August 2018

  
[CNContact.AddPostalAddressJSON](CNContactAddPostalAddressJSON.md) - [CNContact.AddSocialProfile](CNContactAddSocialProfile.md)

[HTML Version](CNContactAddRelation.shtml)