tencent cloud

Chat

News and Announcements
Release Notes
Announcements
Product Introduction
Overview
Basic Concepts
Scenarios
Features
Account System
User Profile and Relationship Chain
Message Management
Group Related
Official Account
Audio/Video Call
Use Limits
Purchase Guide
Billing Overview
Pricing
Purchase Instructions
Renewal Guide
Service Suspension Explanation
Refund Policy
Development Guidelines
Demo Zone
Activate Service
Free Demos
Quick Run
Download
SDK and Demo Source Code
Update Log
Chat Interaction (UI Included)
TUIKit Introduction
Getting Started
Full-feature Integration
Single-function Integration
Build with AI
Build Basic Interfaces
More Features
Customizing Appearance
Internationalization
Push Service
Overview
Noun explanation
Activate the Service
Quick Start
Manufacturer Channel
Statistics
Troubleshooting Tool
Client APIs
REST API
Push Callback
Advanced Features
Release Notes
Error Codes
FAQS
Desk
Overview
Quick Start
Integration Guide
Admin Operation Manual
Agent Manual
More Practices
Live Streaming Setup Guide
AI Chatbot
Super Large Entertainment and Collaboration Community
Discord Implementation Guide
How to Integrate Chat into Games
WhatsApp Channel-style Official Account Integration Solution
Send Red Packet
Firewall Restrictions
No UI Integration
Quick Start
SDK Integration
Initialization
Login and Logout
Message
Conversation
Group
Community Topic
User Profile and Relationship Chain
Offline Push
Cloud Search
Local Search
Official Channel Management
Client APIs
JavaScript
Android
iOS & macOS
Swift
Flutter
Electron
Unity
React Native
C APIs
C++
Server APIs
Secure authentication with UserSig
RESTful APIs
Webhooks
Console Guide
New Console Introduction
Creating and Upgrading an Application
Basic Configuration
Feature Configuration
Account Management
Group Management
Official Channel Management
Webhook Configuration
Usage
Viewing Guide for Resource Packages
Real-Time Monitor
Auxiliary Development Tools
Access Management
Advanced Features
FAQs
uni-app FAQs
Purchase
SDK
Account Authentication
User Profile and Relationship Chain
Message
Group
Audio-Video Group
Nickname and Profile Photo
Security Compliance Certification
Service Level Agreement
Security Compliance Certification
Chat Policies
Privacy Policy
Data Privacy and Security Agreement
Migration
Migration Solutions
Migration Solutions Lite
Error Codes
Contact Us

Android&iOS&Windows&Mac

PDF
Focus Mode
Font Size
Last updated: 2025-03-27 11:01:42

Search Cloud Group Members

Description

You can search for cloud group members by memberID, nickName, and nameCard information. This feature is particularly useful for quickly finding specific group members, such as quickly locating a member in a large group.
Note:
The cloud group member search feature is supported only by version 8.4 or later.
The cloud message search feature is only available to Pro Plus and Enterprise customers and can be used after purchasing Pro Plus and Enterprise; the Free Trial version supports a certain limit of free trial, valid for one month.
If this service is not activated, calling the interface will return the error code 60020.

Search Cloud Group Members Interface

Call the searchCloudGroupMembers (Java / Swift / Objective-C / C++) interface to search for group member information in the cloud。
The parameters of V2TIMGroupMemberSearchParam are as follows:
Parameter
Meaning
Description
keywordList
Keyword list
It can contain up to five keywords, the keyword will automatically match the group member id 、nickname and name card.
keywordListMatchType
Match type of the keyword list
You can set it to search with "OR" logic or "AND" logic. The values are V2TIM_KEYWORD_LIST_MATCH_TYPE_OR and V2TIM_KEYWORD_LIST_MATCH_TYPE_AND, respectively. By default, it uses "OR" logic.
groupIDList
Specify group id list
If groupIDList is set to null,it means searching for group members in all groups, and the returned results will be classified by groupID
If groupIDList is set to not null, it means searching for group members in the specified group.
searchCount
Search Count
Must be greater than 0, maximum supported is 100, default is 20.
searchCursor
Search Cursor
Starting position, fill in an empty character string for the first time, and fill in the searchCursor from the last V2TIMGroupMemberSearchResult returned for subsequent pulls.

Group Member Search Result Class

The message search result class is V2TIMGroupMemberSearchResultJava / Swift / Objective-C / C++). The parameters are as described below:
Parameter
Meaning
Description
isFinished
Is the search finished
Whether all group members that meet the search criteria have been returned.
totalCount
Total search results
The total count of group members that meet the search criteria.
nextCursor
Continue pulling the cursor
The search cursor for the next cloud search.
memberList
Member List
The group member list returned by the current cloud search.
Below is the sample code:
Java
Swift
Objective-C
C++
V2TIMGroupMemberSearchParam searchParam = new V2TIMGroupMemberSearchParam();
searchParam.setKeywordList(keywordList);
searchParam.setKeywordListMatchType(param.V2TIM_KEYWORD_LIST_MATCH_TYPE_OR);
searchParam.setGroupIDList(groupIDList);
searchParam.setSearchCount(20);
searchParam.setSearchCursor("");

V2TIMManager.getGroupManager().searchCloudGroupMembers(searchParam, new V2TIMValueCallback<V2TIMGroupMemberSearchResult>() {
@Override
public void onSuccess(V2TIMGroupMemberSearchResult groupMemberSearchResult) {
// Search Group Member succ
}

@Override
public void onError(int code, String desc) {
// Search Group Member failed
}
});
let param = V2TIMGroupMemberSearchParam()
param.keywordList = ["keyword1", "keyword2"];
param.keywordListMatchType = .V2TIM_KEYWORD_LIST_MATCH_TYPE_OR;
param.groupIDList= ["groupID"];
param.searchCount = 20;
param.searchCursor = "";
V2TIMManager.shared.searchCloudGroupMembers(searchParam: param) { searchResult in
// Search Group Member succ
} fail: { code, desc in
// Search Group Member failed
}

V2TIMGroupMemberSearchParam *param = [[V2TIMGroupMemberSearchParam alloc] init];
param.keywordList = @[@"keyword1", @"keyword2"];
param.keywordListMatchType = V2TIM_KEYWORD_LIST_MATCH_TYPE_OR;
param.groupIDList= @[@"groupID"];
param.searchCount = 20;
param.searchCursor = "";
[[V2TIMManager sharedInstance] searchCloudGroupMembers:param succ:^(V2TIMGroupMemberSearchResult *searchResult) {
// Search Group Member succ
} fail:^(int code, NSString *desc) {
// Search Group Member failed
}];
template <class T>
class ValueCallback final : public V2TIMValueCallback<T> {
public:
using SuccessCallback = std::function<void(const T&)>;
using ErrorCallback = std::function<void(int, const V2TIMString&)>;

ValueCallback() = default;
~ValueCallback() override = default;

void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {
success_callback_ = std::move(success_callback);
error_callback_ = std::move(error_callback);
}

void OnSuccess(const T& value) override {
if (success_callback_) {
success_callback_(value);
}
}
void OnError(int error_code, const V2TIMString& error_message) override {
if (error_callback_) {
error_callback_(error_code, error_message);
}
}

private:
SuccessCallback success_callback_;
ErrorCallback error_callback_;
};

V2TIMGroupMemberSearchParam param;
param.keywordList = keywordList;
param.keywordListMatchType = V2TIM_KEYWORD_LIST_MATCH_TYPE_OR;
param.groupIDList = groupIDList;
param.searchCount = 20;
param.searchCursor = "";

auto callback = new ValueCallback<V2TIMGroupMemberSearchResult>{};
callback->SetCallback(
[=](const V2TIMGroupMemberSearchResult& groupMemberSearchResult) {
// Search Group Member succ
delete callback;
},
[=](int error_code, const V2TIMString& error_message) {
// Search Group Member failed
delete callback;
});

V2TIMManager::GetInstance()->GetGroupManager()->SearchCloudGroupMembers(param, callback);




Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback