Retrieve a list of channels
You can retrieve a list of open channels using SbOpenChannelListQuery
's LoadNextPage()
method, which returns a list of SbOpenChannel
objects.
You can also retrieve a list of the current user's private group channels using the LoadNextPage()
method of a SbGroupChannelListQuery
instance, which returns a list of SbGroupChannel
objects. Using the IncludeEmptyChannel
property of a SbGroupChannelListQuery
instance, you can determine whether to include empty channels in the result. Empty channels are group channels that have been created but don't contain any messages, and thus aren't included in the result by default. However, if you turn off the Chat history option on Sendbird Dashboard, you may retrieve empty channels in the result.
Note: See search group channels by name, URL, or other filters to find out how to search for specific group channels using keywords and filters.
Open channel
Create an SbOpenChannelListQuery
instance to retrieve a list of open channels matching the specifications set by OpenChannelListQuery
. After a list of open channels is successfully retrieved, you can access the data of each open channel from the result list through the openChannel
parameter of the callback method.
Group channel
Create a SbGroupChannelListQuery
instance to retrieve a list of group channels matching the specifications set by SbGroupChannelListQuery
.
You can set SbGroupChannelListQuery
's IncludeEmptyChannel
property to true
so that users can view empty channels since the view chat history option is turned off to prevent new members from seeing previous conversations. You can determine whether to turn on the chat history option on Sendbird Dashboard under Settings > Chat > Channels > Group channels.
List of properties
Property name | Type | Description |
---|---|---|
IncludeEmptyChannel | bool | Determines whether to include empty group channels in the results. |
MyMemberStateFilter | SbMyMemberStateFilter | Restricts the search scope based on the state of the current user. Acceptable values are |
Order | SbGroupChannelListOrder | A list of user IDs invited to the channel. Acceptable values are |
Limit | int | Specifies the number of results to return per call. Acceptable values are |
All public group channels
If you want to retrieve a list of all public group channels regardless of the current user's membership status, use the SbPublicGroupChannelListQuery
instance and set SbPublicGroupChannelMembershipFilter
to SbPublicGroupChannelMembershipFilter.all
in SbPublicSbGroupChannelListQuery
.
After a list of public group channels is successfully retrieved, you can access the data of each channel from the result list.
Supergroup channels
To retrieve a list of Supergroup channels, you can set the SuperChannelFilter
property to SbGroupChannelSuperChannelFilter.SuperChannelOnly
in either the SbGroupChannelListQuery
or SbPublicGroupChannelListQuery
instance. The SuperChannelFilter
property works much like other search filters. Use SbGroupChannelListQuery
when only searching for group channels that the current user belongs to, and use SbPublicGroupChannelListQuery
when searching for all public group channels regardless of the current user's membership status.
When queried channels are returned, you can check if the channel is a Supergroup channel by looking at whether the IsSuper
property has a value of true
.