# 6.7 Add Group Members

The `addGroupMembers` function is used to add  new members to the Group. The members to be added in the group may belong to different companies, provided that the company and the member must already be registered with Bayun. Any existing member of the group can add new members. 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).

The function takes the following parameters :

* **sessionId** : Unique SessionId which is received in the registration/login function response.
* **groupId**  :  GroupId of the group.
* **groupMembers**  : Members to be added in the group.

{% tabs %}
{% tab title="C++" %}
```cpp
#include "BayunCore.h"

std::vector<Bayun::GroupMember> groupMembers;
Bayun::GroupMember groupMember("<companyEmployeeId>", "<companyName>");
groupMembers.push_back(groupMember);
Bayun::ShAddGroupMembersResponse response = bayunCore->addGroupMembers("<sessionId>", "<groupId>", groupMembers);
std::vector<Bayun::ShAddMemberErrObject>  addMemberErrObjects =  response->addMemberErrObjects;

for (Bayun::ShAddMemberErrObject errObject : addMemberErrObjects) {
        std::string  errorMessage = errObject->errorMessage;
        std::vector<Bayun::ShGroupMember> membersList = errObject->membersList;
        for (Bayun::ShGroupMember groupMember : membersList) {
          std::string companyName = groupMember->companyName;
          std::string companyEmployeeId = groupMember->companyEmployeeId;
        }
 }
      
std::string addedMembersCount = response->addedMembersCount;
```
{% endtab %}
{% endtabs %}

