/// <summary> /// Gets a list of health events for the license based subscription. /// </summary> /// <param name="customerId">Identifier of the customer.</param> /// <returns>A list of health events.</returns> private async Task <List <IHealthEvent> > GetOfficeSubscriptionHealthAsync(string customerId) { AuthenticationResult token; ServiceCommunications comm; customerId.AssertNotEmpty(nameof(customerId)); try { token = await Provider.AccessToken.GetAccessTokenAsync( $"{Provider.Configuration.ActiveDirectoryEndpoint}/{customerId}", Provider.Configuration.OfficeManagementEndpoint, new ApplicationCredential { ApplicationId = Provider.Configuration.ApplicationId, ApplicationSecret = Provider.Configuration.ApplicationSecret, UseCache = true }).ConfigureAwait(false); comm = new ServiceCommunications(Provider, token); return(await comm.GetCurrentStatusAsync(customerId).ConfigureAwait(false)); } finally { comm = null; token = null; } }
private async Task <List <IHealthEvent> > GetOfficeSubscriptionHealthAsync(string customerId) { ServiceCommunications comm; if (string.IsNullOrEmpty(customerId)) { throw new ArgumentNullException(nameof(customerId)); } try { comm = new ServiceCommunications(TokenContext.UserAssertionToken); return(await comm.GetCurrentStatusAsync(customerId)); } finally { comm = null; } }
/// <summary> /// Gets a list of health events for the license based subscription. /// </summary> /// <param name="customerId">Identifier of the customer.</param> /// <returns>A list of health events.</returns> private async Task <List <IHealthEvent> > GetOfficeSubscriptionHealthAsync(string customerId) { AuthenticationToken token; ServiceCommunications comm; customerId.AssertNotEmpty(nameof(customerId)); try { token = await this.Service.TokenManagement.GetAppOnlyTokenAsync( $"{this.Service.Configuration.ActiveDirectoryEndpoint}/{customerId}", this.Service.Configuration.OfficeManagementEndpoint); comm = new ServiceCommunications(this.Service, token); return(await comm.GetCurrentStatusAsync(customerId)); } finally { comm = null; token = null; } }