TeamsAnonQueryLinkRouteAttribute Class
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.
Attribute to define a route that handles Teams message extension anonymous query link (anonymous link unfurling) events.
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryLinkHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsAnonQueryLinkRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.QueryLinkHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsAnonQueryLinkRouteAttribute = class
inherit Attribute
interface IRouteAttribute
Public Class TeamsAnonQueryLinkRouteAttribute
Inherits Attribute
Implements IRouteAttribute
- Inheritance
-
TeamsAnonQueryLinkRouteAttribute
- Attributes
- Implements
Remarks
Decorate a method with this attribute to register it as a handler for message extension anonymous query link events in Teams. The method must match the QueryLinkHandler delegate signature.
[TeamsAnonQueryLinkRoute]
public async Task<Response> OnAnonQueryLinkAsync(ITeamsTurnContext turnContext, ITurnState turnState, string url, CancellationToken cancellationToken)
{
var preview = await _service.FetchPreviewAsync(url, cancellationToken);
var attachment = preview.ToCard().ToMessagingExtensionAttachment();
return new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [attachment] } };
}
Alternatively, OnAnonymousQueryLink(QueryLinkHandler, String[], UInt16) can be used to register the handler via the fluent API.
Constructors
| Name | Description |
|---|---|
| TeamsAnonQueryLinkRouteAttribute(Boolean, UInt16, String) |
Attribute to define a route that handles Teams message extension anonymous query link (anonymous link unfurling) events. |
Methods
| Name | Description |
|---|---|
| AddRoute(AgentApplication, MethodInfo) | |