/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Hide or archive a group channel

Copy link

You can hide or archive a specific group channel from the channel list UI using the code below.

groupChannel.Hide(inHidePreviousMessages: false, inAllowAutoUnhide: true, (inError) =>
{
    if (inError != null)
        return; //Handle error.
});
// The channel is successfully hidden from the list.
// The current user's channel view should be refreshed to reflect the change.

groupChannel.Unhide((inError) =>
{
    if (inError != null)
        return; //Handle error.
});
// The channel is successfully unhidden from the list.
// The current user's channel view should be refreshed to reflect the change.

List of parameters

Copy link
Parameter nameTypeDescription

inHidePreviousMessages

bool

Determines whether to show the messages sent and received before hiding or archiving the channel on the channel list. If set to true, previous messages aren't displayed in the channel. (Default: false)

inAllowAutoUnhide

bool

Determines the state and operating behavior of a channel. If set to true, the channel is hidden from the channel list, but when a new message arrives, the hidden channel will show up again on the channel list. If set to false, the channel is archived and stays hidden from the channel list unless the Unhide() method is called. (Default: true)

You can check the channel state on the channel list by using the HiddenState property of a SbGroupChannel object.

enum SbGroupChannelHiddenState
{
  Unhidden,
  HiddenAllowAutoUnhide,
  HiddenPreventAutoUnhide
}

You can also filter channels by their state by following the code below.

SbGroupChannelListQueryParams queryParams = new SbGroupChannelListQueryParams();
queryParams.ChannelHiddenStateFilter = SbChannelHiddenStateFilter.All;

SbGroupChannelListQuery query = SendbirdChat.GroupChannel.CreateMyGroupChannelListQuery(queryParams);
query.LoadNextPage((inChannels, inError) =>
{
    if (inError != null)
        return; // Handle error.
});