CNContactStore.AddGroup
-----------------------

Adds a new group.

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

MBS( "CNContactStore.AddGroup"; Name { ; ContainerIdentifier } ) 

**MBS**( **"CNContactStore.AddGroup";** /\* Adds a new group. \*/  
**$Name**; /\* The new group name.e.g. "Test" \*/   
**$ContainerIdentifier**) /\* Optional; The identifier for the container.e.g. "9892A5CC-964E-497A-B877-A47619F7493C:ABAccount" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Name | The new group name. | "Test" |  |
| ContainerIdentifier | The identifier for the container. | "9892A5CC-964E-497A-B877-A47619F7493C:ABAccount" | Optional |

### Result

Returns OK or error.

### Description

Adds a new group.  
Optionally pass in container identifier to specify which account to use.  
### Examples

Create a group:

 Set Variable \[ $r ; Value: MBS ( "CNContactStore.AddGroup"; "Test Group") \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to create a group" ; $r \]   
Else  
 Set Field \[ Contacts::GroupID ; $r \]   
End If  
### See also

- [CNContactStore.AddMember](CNContactStoreAddMember.md)
- [CNContactStore.AddSubgroup](CNContactStoreAddSubgroup.md)
- [CNContactStore.DeleteGroup](CNContactStoreDeleteGroup.md)
- [CNContactStore.Groups](CNContactStoreGroups.md)
- [CNContactStore.RenameGroup](CNContactStoreRenameGroup.md)
- [CNContactStore.Subgroups](CNContactStoreSubgroups.md)
- [IsError](IsError.md)

### Example Databases

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

This function checks for a license.

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

  
[CNContactStore.AddContact](CNContactStoreAddContact.md) - [CNContactStore.AddMember](CNContactStoreAddMember.md)

[HTML Version](CNContactStoreAddGroup.shtml)