MessageExtension.OnSelectItem<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.
Registers a handler that implements the logic to handle the tap actions for items returned by a Search based message extension.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnSelectItem<TData>(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemHandler<TData> handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnSelectItem : Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SelectItemHandler<'Data> * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnSelectItem(Of TData) (handler As SelectItemHandler(Of TData), Optional autoSignInHandlers As String() = Nothing, Optional rank As UShort = 32767) As MessageExtension
Type Parameters
- TData
The type of the data argument on the handler.
Parameters
- handler
- SelectItemHandler<TData>
Function to call when the event is triggered.
- autoSignInHandlers
- String[]
OAuth sign-in handler names for automatic sign-in before the route handler is invoked. Specify null to skip automatic sign-in.
- rank
- UInt16
Route evaluation order. Lower values run first. Defaults to Unspecified.
Returns
The application instance for chaining purposes.
Remarks
``` TeamsExtension.MessageExtensions.OnSelectItem<ProductSummary>(async (ctx, state, item, ct) => { var details = await _catalog.GetDetailsAsync(item.Id, ct); return new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [details.ToHeroCard().ToMessagingExtensionAttachment()] } }; }); ``` Alternatively, the TeamsSelectItemRouteAttribute can be used to decorate a SelectItemHandler<TData> method for the same purpose.