示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#4
0
 private string GetToken(bool isRefresh)
 {
     return(AuthenticationHelperSDK.GetToken(Constants.OfficeResourceId));
 }