Docs
/
In-App UI
React
Hooks
useMsTeamsChannels

useMsTeamsChannels

The useMsTeamsChannels hook is used to retrieve available Microsoft Teams channels for a specific team. This hook must be used within a KnockMsTeamsProvider.

Parameters

#

Accepts an object with the following properties:

teamIdstring

Optional ID of the Microsoft Teams team to get channels for. If not provided, no channels will be fetched.

queryOptionsMsTeamsChannelQueryOptions

Optional query options for filtering and selecting channel fields.

Returns

#

Returns an object with the following properties:

dataMsTeamsChannel[]

Array of available Microsoft Teams channels.

isLoadingboolean

Whether channels are being loaded or revalidating.

refetch() => void

Function to manually refetch the channels.

Example

#

Basic usage

#

The following example demonstrates how to use the useMsTeamsChannels hook to display available Microsoft Teams channels.

With query options

#

You can customize the query with filtering and field selection options: