MessageExtension.OnMessagePreviewSend 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 |
|---|---|
| OnMessagePreviewSend(String, MessagePreviewSendHandler, String[], UInt16) |
Registers a handler to process the 'send' action of a message that's being previewed by the user prior to sending. |
| OnMessagePreviewSend(Regex, MessagePreviewSendHandler, String[], UInt16) |
Registers a handler to process the 'send' action of a message that's being previewed by the user prior to sending. |
OnMessagePreviewSend(String, MessagePreviewSendHandler, String[], UInt16)
Registers a handler to process the 'send' action of a message that's being previewed by the user prior to sending.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnMessagePreviewSend(string commandId, Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnMessagePreviewSend : string * Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnMessagePreviewSend (commandId As String, handler As MessagePreviewSendHandler, 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
- MessagePreviewSendHandler
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
``` TeamsExtension.MessageExtensions.OnMessagePreviewSend("composeCmd", async (ctx, state, preview, ct) => { var content = preview.Attachments?.FirstOrDefault()?.Content; await _channel.PostAsync(content, ct); }); ``` Alternatively, the TeamsMessagePreviewSendRouteAttribute can be used to decorate a MessagePreviewSendHandler method for the same purpose.
Applies to
OnMessagePreviewSend(Regex, MessagePreviewSendHandler, String[], UInt16)
Registers a handler to process the 'send' action of a message that's being previewed by the user prior to sending.
public Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension OnMessagePreviewSend(System.Text.RegularExpressions.Regex commandIdPattern, Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler handler, string[] autoSignInHandlers = default, ushort rank = 32767);
member this.OnMessagePreviewSend : System.Text.RegularExpressions.Regex * Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessagePreviewSendHandler * string[] * uint16 -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.MessageExtension
Public Function OnMessagePreviewSend (commandIdPattern As Regex, handler As MessagePreviewSendHandler, Optional autoSignInHandlers As String() = Nothing, Optional rank As UShort = 32767) As MessageExtension
Parameters
- commandIdPattern
- Regex
Regular expression to match against the ID of the command to register the handler for.
- handler
- MessagePreviewSendHandler
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 TeamsMessagePreviewSendRouteAttribute can be used to decorate a MessagePreviewSendHandler method for the same purpose.