setGroupMemberRole

Introduction

Set the role of a member in the group.

The group owner can call setGroupMemberRole to change the role of a member of a public group (Public) or meeting group (Meeting). Roles available for changing are ordinary member and group admin.

After a member is set as group admin, all group members (including the new admin) receive the OnGrantAdministrator callback.

After the admin role is removed for a member, all group members (including the member with admin role removed) receive the OnRevokeAdministrator callback.

Parameter details

Parameter name Parameter type Required Description
groupID string yes The group ID.
userID string yes The target user ID.
role GroupMemberRoleTypeEnum yes The new role type of a group member.

Returned template

V2TimCallback

{
    code : number
    desc : string
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.

Code example

import {
    TencentImSDKPlugin,
    GroupMemberRoleTypeEnum,
} from 'react-native-tim-js';


const setGroupMemberRoleRes = await TencentImSDKPlugin.v2TIMManager
    .getGroupManager()
    .setGroupMemberRole(
        'groupID',
        'userID',
        GroupMemberRoleTypeEnum.V2TIM_GROUP_MEMBER_ROLE_ADMIN
    );
if (setGroupMemberRoleRes.code === 0) {

}

results matching ""

    No results matching ""