SelectItemRouteBuilder.WithHandler<TData> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Configures the route to use the specified asynchronous handler for processing select item.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemRouteBuilder WithHandler<TData>(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemHandler<TData> handler);
member this.WithHandler : Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemHandler<'Data> -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemRouteBuilder
Public Function WithHandler(Of TData) (handler As SelectItemHandler(Of TData)) As SelectItemRouteBuilder
Type Parameters
- TData
The type of data extracted from the select item action payload and passed to the handler. This comes from the Activity.Value and will be JsonElement.
Parameters
- handler
- SelectItemHandler<TData>
An asynchronous delegate that processes the select item, receiving the turn context, turn state, deserialized data
of type TData, and a cancellation token.
Returns
The current instance of SelectItemRouteBuilder, enabling method chaining.
Remarks
Use this method to specify custom logic for handling select item actions in Teams message extensions. The handler receives the deserialized data from the incoming activity, allowing for type-safe processing of the action's payload.