コード例 #1
0
ファイル: KellyTest.cs プロジェクト: ProjectAgri20/newrepo
        private static void Autodiscover(string userName, string domain)
        {
            NetworkCredential credential = new NetworkCredential(userName, domain);

            HP.ScalableTest.TraceFactory.Logger.Debug("Autodiscovering...");
            HP.ScalableTest.TraceFactory.Logger.Debug("User:"******"Domain: " + domain);

            MailAddress address = ExchangeEmailController.GetLdapEmailAddress(credential);
            var         uri     = ExchangeEmailController.AutodiscoverExchangeUrl(address);

            HP.ScalableTest.TraceFactory.Logger.Debug("Autodiscovered URL:" + uri.ToString());

            _emailController = new ExchangeEmailController(credential, uri);
        }
コード例 #2
0
        /// <summary>
        /// Initializes the Exchange version and the URL so we don't have to use autodiscover for all the subscribers.
        /// </summary>
        /// <param name="credential"></param>
        private static void Initialize(NetworkCredential credential)
        {
            ExchangeConnectionSettings settings = new ExchangeConnectionSettings(_exchangeServerSettings);

            if (settings.AutodiscoverEnabled)
            {
                Action action = new Action(() =>
                {
                    TraceFactory.Logger.Debug("Autodiscover lock acquired.  Autodiscovering the Exchange Server.");
                    MailAddress autodiscoverAddress = ExchangeEmailController.GetLdapEmailAddress(credential);
                    _exchangeUrl = ExchangeEmailController.AutodiscoverExchangeUrl(autodiscoverAddress);
                });

                TraceFactory.Logger.Debug("Attempting to autodiscover against Exchange");
                CriticalSection criticalSection = new CriticalSection(new DistributedLockManager(GlobalSettings.WcfHosts["Lock"]));
                criticalSection.Run(new LocalLockToken("ExchangeAutodiscover", new TimeSpan(0, 5, 0), new TimeSpan(0, 5, 0)), action);
            }
            else
            {
                TraceFactory.Logger.Debug("Configuring exchange service using Exchange Web Services URL.");
                _exchangeUrl = settings.EwsUrl;
            }
        }