MessageExtension.OnQueryLink(QueryLinkHandler, String[], UInt16) 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 a Link Unfurling based Message Extension.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnQueryLink(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryLinkHandler handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnQueryLink : Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryLinkHandler * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnQueryLink (handler As QueryLinkHandler, Optional autoSignInHandlers As String() = Nothing, Optional rank As UShort = 32767) As MessageExtension
Parameters
- handler
- QueryLinkHandler
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.OnQueryLink(async (ctx, state, url, ct) => { var preview = await _service.FetchPreviewAsync(url, ct); return new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [preview.ToCard().ToMessagingExtensionAttachment()] } }; }); ``` Alternatively, the TeamsQueryLinkRouteAttribute can be used to decorate a QueryLinkHandler method for the same purpose.