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); } }
public AutoDiscoverClient(string componentId, Task.TaskVerboseLoggingDelegate verbose, CredentialsImpersonator credentialsImpersonator, string emailAddress, string url, bool reportErrors, params string[] optionalHeaders) { this.verboseDelegate = verbose; this.credentialsImpersonator = credentialsImpersonator; this.url = url; this.emailAddress = emailAddress; this.reportErrors = reportErrors; this.componentId = componentId; if (optionalHeaders.Length % 2 != 0) { throw new ArgumentException("optionalHeaders"); } this.additionalHeaders = new Dictionary <string, string>(); for (int i = 0; i < optionalHeaders.Length; i += 2) { this.additionalHeaders.Add(optionalHeaders[i], optionalHeaders[i + 1]); } }