TeamsAgentExtension.GetGraphClient(ITurnContext, String, String) 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.
Creates a new instance of the GraphServiceClient for accessing Microsoft Graph APIs using the current turn context.
public Microsoft.Graph.GraphServiceClient GetGraphClient(Microsoft.Agents.Builder.ITurnContext turnContext, string handlerName = default, string graphBaseUrl = "https://graph.microsoft.com/v1.0");
member this.GetGraphClient : Microsoft.Agents.Builder.ITurnContext * string * string -> Microsoft.Graph.GraphServiceClient
Public Function GetGraphClient (turnContext As ITurnContext, Optional handlerName As String = Nothing, Optional graphBaseUrl As String = "https://graph.microsoft.com/v1.0") As GraphServiceClient
Parameters
- turnContext
- ITurnContext
The turn context containing information about the current conversation and user. Cannot be null.
- handlerName
- String
The name of the handler to use for token acquisition. If null, the default handler is used.
- graphBaseUrl
- String
The base URL for the Microsoft Graph API. Defaults to "https://graph.microsoft.com/v1.0".
Returns
A GraphServiceClient instance configured with authentication for the current turn context.
Remarks
Use this method to obtain a GraphServiceClient that is pre-authenticated for the user or bot associated with the current turn. The returned client can be used to make requests to Microsoft Graph on behalf of the user. This requires that UserAuthorization is properly configured and the user is signed in.