MessageExtension.OnSubmitAction 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.
Overloads
| Name | Description |
|---|---|
| OnSubmitAction(String, SubmitActionHandler, String[], UInt16) |
Registers a handler that implements the submit action for an Action based Message Extension. |
| OnSubmitAction(Regex, SubmitActionHandler, String[], UInt16) |
Registers a handler that implements the submit action for an Action based Message Extension. |
OnSubmitAction(String, SubmitActionHandler, String[], UInt16)
Registers a handler that implements the submit action for an Action based Message Extension.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnSubmitAction(string commandId, Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnSubmitAction : string * Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnSubmitAction (commandId As String, handler As SubmitActionHandler, Optional autoSignInHandlers As String() = Nothing, Optional rank As UShort = 32767) As MessageExtension
Parameters
- commandId
- String
ID of the command to register the handler for.
- handler
- SubmitActionHandler
Function to call when the command is received.
- 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
``` public record CreateTaskData(string Title, string AssignedTo);
TeamsExtension.MessageExtensions.OnSubmitAction<CreateTaskData>("createTask", async (ctx, state, data, ct) => { var task = await _service.CreateAsync(data.Title, data.AssignedTo, ct); return new Response { ComposeExtension = new Result { Type = ResultType.List, Attachments = [task.ToCard()] } }; }); ``` Alternatively, the TeamsSubmitActionRouteAttribute can be used to decorate a SubmitActionHandler method for the same purpose.
Applies to
OnSubmitAction(Regex, SubmitActionHandler, String[], UInt16)
Registers a handler that implements the submit action for an Action based Message Extension.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnSubmitAction(System.Text.RegularExpressions.Regex commandIdPattern, Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnSubmitAction : System.Text.RegularExpressions.Regex * Microsoft.Agents.Extensions.MSTeams.MessageExtensions.SubmitActionHandler * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnSubmitAction (commandIdPattern As Regex, handler As SubmitActionHandler, Optional autoSignInHandlers As String() = Nothing, Optional rank As UShort = 32767) As MessageExtension
Parameters
- commandIdPattern
- Regex
Regular expression to match against the ID of the commands to register the handler for.
- handler
- SubmitActionHandler
Function to call when the command is received.
- 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
Alternatively, the TeamsSubmitActionRouteAttribute can be used to decorate a SubmitActionHandler method for the same purpose.