コード例 #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 a new instance of the <see cref="OutputEmailMonitor"/> class.
        /// </summary>
        /// <param name="monitorConfig">The monitor configuration.</param>
        public OutputEmailMonitor(MonitorConfig monitorConfig)
            : base(monitorConfig)
        {
            _timer = new Timer(new TimerCallback(TimerFire));

            // Set up the email controller for this domain
            string password = GlobalSettings.Items[Setting.OfficeWorkerPassword];
            string domain   = GlobalSettings.Items[Setting.Domain];

            _credential   = new NetworkCredential(base.Configuration.MonitorLocation, password, domain);
            _emailAddress = ExchangeEmailController.GetLdapEmailAddress(_credential);

            // Set up a temporary path and make sure it exists
            _tempPath = Path.Combine(Path.GetTempPath(), "EmailMonitor", base.Configuration.MonitorLocation);
            System.IO.Directory.CreateDirectory(_tempPath);
        }
コード例 #3
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;
            }
        }