TeamsSubmitActionRouteAttribute 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 submit action events for a specific command.
[Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler))]
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
public class TeamsSubmitActionRouteAttribute : Attribute, Microsoft.Agents.Builder.App.IRouteAttribute
[<Microsoft.Agents.Builder.App.RouteHandlerType(typeof(Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler))>]
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
type TeamsSubmitActionRouteAttribute = class
inherit Attribute
interface IRouteAttribute
Public Class TeamsSubmitActionRouteAttribute
Inherits Attribute
Implements IRouteAttribute
- Inheritance
-
TeamsSubmitActionRouteAttribute
- Attributes
- Implements
Remarks
Decorate a method with this attribute to register it as a handler for message extension submit action events in Teams. The method must match the SubmitActionHandler delegate signature — the third parameter must be Microsoft.Teams.Api.MessageExtensions.Action.
[TeamsSubmitActionRoute("createTask")]
public async Task<Response> OnCreateTaskAsync(ITeamsTurnContext turnContext, ITurnState turnState, Microsoft.Teams.Api.MessageExtensions.Action action, CancellationToken cancellationToken)
{
var task = await _taskService.CreateAsync(action.Data["title"]?.ToString(), action.Data["assignedTo"]?.ToString(), cancellationToken);
var card = task.ToAdaptiveCard().ToMessagingExtensionAttachment();
return new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [card] } };
}
Alternatively, OnSubmitAction(String, SubmitActionHandler, String[], UInt16) can be used to register the handler via the fluent API.
Constructors
| Name | Description |
|---|---|
| TeamsSubmitActionRouteAttribute(String, String, Boolean, UInt16, String) |
Attribute to define a route that handles Teams message extension submit action events for a specific command. |
Methods
| Name | Description |
|---|---|
| AddRoute(AgentApplication, MethodInfo) | |