コード例 #1
0
        public static void DiscoverBegin(string componentId, string emailAddress, CredentialsImpersonator credentialsImpersonator, ITopologyConfigurationSession configSession, Task.TaskVerboseLoggingDelegate verboseDelegate, AsyncCallback asyncCallback, params string[] optionalHeaders)
        {
            if (string.IsNullOrEmpty(componentId))
            {
                throw new ArgumentNullException("componentId");
            }
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress");
            }
            if (credentialsImpersonator == null)
            {
                throw new ArgumentNullException("credentialsImpersonator");
            }
            if (configSession == null)
            {
                throw new ArgumentNullException("configSession");
            }
            if (configSession == null)
            {
                throw new ArgumentNullException("verboseDelegate");
            }
            if (asyncCallback == null)
            {
                throw new ArgumentNullException("asyncCallback");
            }
            string autoDiscoverEndpoint = AutoDiscoverHelper.GetAutoDiscoverEndpoint(emailAddress, configSession, verboseDelegate);

            verboseDelegate(Strings.TowsAutodiscoverUrl(autoDiscoverEndpoint));
            if (!string.IsNullOrEmpty(autoDiscoverEndpoint))
            {
                AutoDiscoverClient autoDiscoverClient = new AutoDiscoverClient(componentId, verboseDelegate, credentialsImpersonator, emailAddress, autoDiscoverEndpoint, true, optionalHeaders);
                autoDiscoverClient.BeginInvoke(asyncCallback);
            }
        }
コード例 #2
0
        private HttpWebRequest SendRequest(ICredentials credentials)
        {
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(this.url);

            AutoDiscoverClient.AddOutlook14Cookie(httpWebRequest);
            httpWebRequest.Method          = "POST";
            httpWebRequest.ContentType     = "text/xml; charset=utf-8";
            httpWebRequest.Credentials     = credentials;
            httpWebRequest.PreAuthenticate = true;
            httpWebRequest.Headers.Set(HttpRequestHeader.Pragma, "no-cache");
            foreach (string text in this.additionalHeaders.Keys)
            {
                httpWebRequest.Headers.Add(text, this.additionalHeaders[text]);
            }
            httpWebRequest.UserAgent = string.Format("{0}/{1}/{2}", Environment.MachineName, this.componentId, this.emailAddress);
            CertificateValidationManager.SetComponentId(httpWebRequest, this.componentId);
            this.TraceHeaders(httpWebRequest.Headers);
            using (Stream requestStream = httpWebRequest.GetRequestStream())
            {
                SafeXmlSerializer      safeXmlSerializer = new SafeXmlSerializer(typeof(AutoDiscoverRequestXML));
                AutoDiscoverRequestXML o = AutoDiscoverRequestXML.NewRequest(this.emailAddress);
                safeXmlSerializer.Serialize(requestStream, o);
            }
            return(httpWebRequest);
        }
コード例 #3
0
 public static AutoDiscoverResponseXML DiscoverEnd(IAsyncResult asyncResult, out string url)
 {
     return(AutoDiscoverClient.EndInvoke(asyncResult, out url));
 }
コード例 #4
0
        public static AutoDiscoverResponseXML EndInvoke(IAsyncResult asyncResult, out string url)
        {
            AutoDiscoverClient autoDiscoverClient = asyncResult.AsyncState as AutoDiscoverClient;

            return(autoDiscoverClient.EndInvokeInternal(asyncResult, out url));
        }