Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Set group member friend permission

Control whether members can send friend requests to each other from within the group.

Copy

This setting governs whether group members can initiate friend applications to fellow members through the group interface. It does not hide member profile cards or affect existing friendships:

Code example

import sdk, { GroupApplyMemberFriend, SetGroupInfoReq } from '@openimsdk/imsdk';

const request: SetGroupInfoReq = {
  groupID: groupID,
  applyMemberFriend: GroupApplyMemberFriend.AllowGroupApplyMemberFriend,
};
await sdk.setGroupInfo(request);

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.
applyMemberFriendGroupApplyMemberFriendYesMember friend addition policy enum value.
OptionValueDescription
GroupApplyMemberFriend.AllowGroupApplyMemberFriend0Members may send friend requests to each other from the group.
GroupApplyMemberFriend.ProhibitGroupApplyMemberFriend1Members are prohibited from sending friend requests to each other within the group.

Return value

Returns a Promise that resolves to void upon updating the permission.

State changes after the call

Resolving the Promise updates the policy on the server. The SDK emits EventOnGroupInfoChanged; match the group by groupID and update its applyMemberFriend property in UI state, as detailed in Group overview.