Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new constructor for GraphServiceClient #2081

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Microsoft.Graph/GraphServiceClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

Expand Down Expand Up @@ -52,6 +52,22 @@ public GraphServiceClient(
{
}

/// <summary>
/// Constructs a new <see cref="GraphServiceClient"/>.
/// </summary>
/// <param name="httpClient">The customized <see cref="HttpClient"/> to be used for making requests</param>
/// <param name="tokenCredential">The <see cref="TokenCredential"/> for authenticating request messages.</param>
/// <param name="scopes">List of scopes for the authentication context.</param>
/// <param name="baseUrl">The base service URL. For example, "https://graph.microsoft.com/v1.0"</param>
public GraphServiceClient(
HttpClient httpClient,
TokenCredential tokenCredential,
IEnumerable<string> scopes = null,
string baseUrl = null
):this(httpClient, new Microsoft.Graph.Authentication.AzureIdentityAuthenticationProvider(tokenCredential, null, null, scopes?.ToArray() ?? Array.Empty<string>()), baseUrl)
{
}

/// <summary>
/// Constructs a new <see cref="GraphServiceClient"/>.
/// </summary>
Expand Down
Loading