private OutlookServicesClient GetOutlookClient(string capability) { if (_outlookClient != null) { return(_outlookClient); } try { Uri serviceEndpointUri; string serviceResourceId; GetService(capability, out serviceEndpointUri, out serviceResourceId); _outlookClient = new OutlookServicesClient( serviceEndpointUri, async() => await AuthenticationHelperSDK.GetTokenAsync(serviceResourceId)); } catch (Exception ex) { Log.Out(Log.Severity.Warning, string.Empty, ex.ToString()); } return(_outlookClient); }
public MailStoreProviderSDK(string userName, string password) { _adClient = AuthenticationHelperSDK.GetGraphClientAsync(userName, password).GetResult(); _outlookClient = GetOutlookClient("Mail"); _user = _outlookClient.Me.ExecuteAsync().GetResult(); DisplayName = _user.Id; RootFolder = new MailFolderProviderSDK(_outlookClient, _user.Id); }
private void GetService(string capability, out Uri serviceEndpointUri, out string serviceResourceId) { var discoveryClient = new DiscoveryClient(DiscoveryServiceEndpointUri, async() => await AuthenticationHelperSDK.GetTokenAsync(DiscoveryResourceId)); CapabilityDiscoveryResult result = discoveryClient.DiscoverCapabilityAsync(capability).Result; serviceEndpointUri = result.ServiceEndpointUri; serviceResourceId = result.ServiceResourceId; }
private string GetToken(bool isRefresh) { return(AuthenticationHelperSDK.GetToken(Constants.OfficeResourceId)); }