public MicrosoftGraphAPI(string connectionString) { AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider(connectionString); string microsoftGraphEndpoint = "https://graph.microsoft.com"; var token = azureServiceTokenProvider.GetAccessTokenAsync(microsoftGraphEndpoint).ConfigureAwait(false).GetAwaiter().GetResult(); Task authenticationDelegate(System.Net.Http.HttpRequestMessage req) { req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); return(Task.CompletedTask); } _restClient = new RESTClient(token); _graphClient = new GraphServiceClient(new DelegateAuthenticationProvider(authenticationDelegate)); _oneDrive = new OneDrive(_restClient); }
public OneDrive(RESTClient restClient) { _restClient = restClient; }