Language

QueryRouteBuilder.WithHandler(QueryHandler) Method

Definition

Configures the route to use the specified asynchronous handler for processing query.

public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryRouteBuilder WithHandler(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryHandler handler);
member this.WithHandler : Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryHandler -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryRouteBuilder
Public Function WithHandler (handler As QueryHandler) As QueryRouteBuilder

Parameters

handler
QueryHandler

An asynchronous delegate that processes the query, receiving the turn context, turn state, deserialized data of type Microsoft.Teams.Api.MessageExtensions.Query, and a cancellation token.

Returns

The current instance of QueryRouteBuilder, enabling method chaining.

Remarks

Use this method to specify custom logic for handling queries in Teams message extensions. The handler receives the deserialized data from the incoming activity, allowing for type-safe processing of the query's payload.

Applies to