Language

TeamsFetchActionRouteAttribute Class

Definition

Attribute to define a route that handles Teams message extension composeExtension/fetchTask Invokes for a specific command.

[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.FetchActionHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsFetchActionRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.FetchActionHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsFetchActionRouteAttribute = class
    inherit Attribute
    interface IRouteAttribute
Public Class TeamsFetchActionRouteAttribute
Inherits Attribute
Implements IRouteAttribute
Inheritance
TeamsFetchActionRouteAttribute
Attributes
Implements

Remarks

Decorate a method with this attribute to register it as a handler for message extension composeExtension/fetchTask Invokes in Teams. The method must match the FetchActionHandler delegate signature.

[TeamsFetchActionRoute("myCommand")]
public Task<ActionResponse> OnFetchTaskAsync(ITeamsTurnContext turnContext, ITurnState turnState, Microsoft.Teams.Api.MessageExtensions.Action action, CancellationToken cancellationToken)
{
    return Task.FromResult(new ActionResponse
    {
        Task = new TaskInfo
        {
            Type = TaskInfoType.Continue,
            Value = new TaskModuleTaskInfo { Title = "My Form", Height = 300, Width = 400, Url = "https://example.com/form" }
        }
    });
}

Alternatively, OnFetchAction(String, FetchActionHandler, String[], UInt16) can be used to register the handler via the fluent API.

Constructors

Name Description
TeamsFetchActionRouteAttribute(String, String, Boolean, UInt16, String)

Attribute to define a route that handles Teams message extension composeExtension/fetchTask Invokes for a specific command.

Methods

Name Description
AddRoute(AgentApplication, MethodInfo)

Applies to