Share via


NotificationBot.FindChannelAsync Method

Definition

Returns the first Channel where predicate is true, and null otherwise. (Ensure the bot app is installed into the General channel, otherwise null will be returned.)

public System.Threading.Tasks.Task<Microsoft.TeamsFx.Conversation.Channel> FindChannelAsync (Func<Microsoft.TeamsFx.Conversation.Channel,Microsoft.Bot.Schema.Teams.TeamDetails,System.Threading.Tasks.Task<bool>> predicate, System.Threading.CancellationToken cancellationToken = default);
member this.FindChannelAsync : Func<Microsoft.TeamsFx.Conversation.Channel, Microsoft.Bot.Schema.Teams.TeamDetails, System.Threading.Tasks.Task<bool>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.TeamsFx.Conversation.Channel>
Public Function FindChannelAsync (predicate As Func(Of Channel, TeamDetails, Task(Of Boolean)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Channel)

Parameters

predicate
Func<Channel,TeamDetails,Task<Boolean>>

Find calls predicate once for each channel of the installation, until it finds one where predicate returns true. If such a channel is found, find immediately returns that channel.Otherwise, find returns null.

cancellationToken
CancellationToken

The cancellation token.

Returns

The first Channel where predicate is true, and null otherwise.

Exceptions

Throws when predicate is null.

Applies to