TeamsSettingRouteAttribute(Boolean, UInt16, String) Constructor
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 configure settings events.
public TeamsSettingRouteAttribute(bool isAgenticOnly = false, ushort rank = 32767, string signInHandlers = default);
new Microsoft.Agents.Extensions.MSTeams.MessageExtensions.TeamsSettingRouteAttribute : bool * uint16 * string -> Microsoft.Agents.Extensions.MSTeams.MessageExtensions.TeamsSettingRouteAttribute
Public Sub New (Optional isAgenticOnly As Boolean = false, Optional rank As UShort = 32767, Optional signInHandlers As String = Nothing)
Parameters
- isAgenticOnly
- Boolean
When true, the route only fires for agentic turns. Defaults to false.
- rank
- UInt16
Route evaluation order. Lower values run first. Defaults to Unspecified.
- signInHandlers
- String
A comma/space/semicolon-delimited list of OAuth sign-in handler names, or the name of an instance method on the agent class matching Func<ITurnContext, string[]>.
Remarks
Decorate a method with this attribute to register it as a handler for message extension configure settings events in Teams. The method must match the SettingHandler delegate signature.
[TeamsSettingRoute]
public Task<Response> OnSettingAsync(ITeamsTurnContext turnContext, ITurnState turnState, Microsoft.Teams.Api.MessageExtensions.Query query, CancellationToken cancellationToken)
{
// Persist user settings and return an updated result
var setting = query.Parameters.FirstOrDefault()?.Value ?? string.Empty;
_settingsStore.Save(turnContext.Activity.From.Id, setting);
return Task.FromResult(new Response { ComposeExtension = new Result { Type = ResultType.Config } });
}
Alternatively, OnSetting(SettingHandler, String[], UInt16) can be used to register the handler via the fluent API.