# 7.6 Add Group Member

The `addInGroup:groupMember:success:failure:` method is used to add a new member to the Group. The member to be added in the group may belong to a different company, provided that the company and the member must already be registered with Bayun. Any existing member of the group can add a new member. The developer can enforce stricter access-mechanisms on top if desired (e.g. only group-owner or group-admin is allowed to add new members).

**Method parameters :**

* **groupId** : GroupId of the group.
* **groupMember** : `GroupMember` with companyName and companyEmployeeId.
* **success** : Success block to be executed after member is added to the group.
* **failure** : Failure block to be executed if member could not be added to the group, returns `BayunError`.

{% tabs %}
{% tab title="Objective-C" %}
```objectivec
GroupMember *groupMember = [[GroupMember alloc] initWithCompanyName:@"<companyName>" companyEmployeeId:@"<companyEmployeeId>"];
[[BayunCore sharedInstance] addInGroup:@"<groupId>" groupMember:groupMember success:^{
  NSLog(@"Group member added successfully.");       
} failure:^(BayunError error) {
   NSLog(@"Error adding the group member");
}];
```
{% endtab %}

{% tab title="Swift" %}
```swift
 let groupMember : GroupMember = GroupMember(companyName:"<companyName>", companyEmployeeId: "<companyEmployeeId>")
 BayunCore.sharedInstance()?.add(inGroup: "<groupId>", groupMember: groupMember, success: {
  NSLog("Group member added successfully.")
 }, failure: { (error) in
  NSLog("Error adding the group member") 
})
```
{% endtab %}
{% endtabs %}
