Language

AddBotApplicationExtensions.AddBotClient<TClient> Method

Definition

Registers a typed HttpClient for TClient wired to bot authentication using an already-resolved BotConfig.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddBotClient<TClient>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string httpClientName, Microsoft.Teams.Core.Hosting.BotConfig botConfig) where TClient : class;
static member AddBotClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Teams.Core.Hosting.BotConfig -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Client : null)
<Extension()>
Public Function AddBotClient(Of TClient As Class) (services As IServiceCollection, httpClientName As String, botConfig As BotConfig) As IServiceCollection

Type Parameters

TClient

The client class to register the named HttpClient for.

Parameters

services
IServiceCollection

The service collection to add services to.

httpClientName
String

The named HttpClient registration to associate with TClient.

botConfig
BotConfig

The resolved bot configuration containing tenant and client settings.

Returns

The service collection for method chaining.

Remarks

EnsureMsalServices(IServiceCollection, BotConfig) must be called on the same service collection before the resulting client is used, so that IAuthorizationHeaderProvider and the named MSAL options are registered.

Applies to