private Dictionary <string, string> CreatePropertyBag() { Dictionary <string, string> dictionary = null; try { dictionary = TestOutlookConnectivity.CreateTestOutlookConnectivityPropertyBag(this.mailboxAdUser, this.IsProbePasswordAuthenticated, this.IsCtpTest, this.Credential, this.authenticateAsUser, this.Hostname); TestOutlookConnectivity.AddToPropertyBag(dictionary, "TimeoutSeconds", this.TimeOutSeconds); TestOutlookConnectivity.AddToPropertyBag(dictionary, "ServiceName", MonitoringItemIdentity.MonitorIdentityId.GetHealthSet(this.ProbeIdentity)); TestOutlookConnectivity.AddToPropertyBag(dictionary, "Name", MonitoringItemIdentity.MonitorIdentityId.GetMonitor(this.ProbeIdentity)); TestOutlookConnectivity.AddToPropertyBag(dictionary, "TargetResource", MonitoringItemIdentity.MonitorIdentityId.GetTargetResource(this.ProbeIdentity)); } catch (ArgumentException exception) { base.WriteError(exception, (ErrorCategory)1000, null); } return(dictionary); }
internal static Dictionary <string, string> CreateTestOutlookConnectivityPropertyBag(ADUser mailboxAdUser, bool isPasswordAuthenticated, bool isCtpTest, PSCredential mailboxCredential, ADUser adUserCorrespondingToMailboxCredential, string endpoint) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); Dictionary <string, string> dictionary2 = new Dictionary <string, string>(0); AutodiscoverCommonUserSettings autodiscoverCommonUserSettings = null; if (mailboxAdUser != null) { TestOutlookConnectivity.AddToPropertyBag(dictionary2, "MailboxLegacyDN", mailboxAdUser.LegacyExchangeDN); autodiscoverCommonUserSettings = AutodiscoverCommonUserSettings.GetSettingsFromRecipient(mailboxAdUser, mailboxAdUser.PrimarySmtpAddress.ToString()); TestOutlookConnectivity.AddToPropertyBag(dictionary2, "PersonalizedServerName", string.Format("{0}@{1}", autodiscoverCommonUserSettings.MailboxGuid, autodiscoverCommonUserSettings.PrimarySmtpAddress.Domain)); if (!TestOutlookConnectivity.IsMailboxCredentialEmpty(mailboxCredential)) { if (adUserCorrespondingToMailboxCredential == null) { throw new ArgumentException("This should never happen. If mailboxCredential is passed in, then adUserCorrespondingToMailboxCredential should match."); } TestOutlookConnectivity.AddToPropertyBag(dictionary, "Account", TestOutlookConnectivity.GetAccountLoginName(adUserCorrespondingToMailboxCredential)); TestOutlookConnectivity.AddToPropertyBag(dictionary2, "AccountLegacyDN", adUserCorrespondingToMailboxCredential.LegacyExchangeDN); if (isPasswordAuthenticated) { string value = TestOutlookConnectivity.ConvertSecureStringToPlainString(mailboxCredential.Password); TestOutlookConnectivity.AddToPropertyBag(dictionary, "Password", value); } } } TestOutlookConnectivity.AddToPropertyBag(dictionary, "Endpoint", endpoint); if (!isCtpTest) { TestOutlookConnectivity.AddToPropertyBag(dictionary, "SecondaryEndpoint", endpoint); } if (autodiscoverCommonUserSettings != null && !string.IsNullOrEmpty(autodiscoverCommonUserSettings.RpcServer) && isCtpTest) { TestOutlookConnectivity.AddToPropertyBag(dictionary, "SecondaryEndpoint", autodiscoverCommonUserSettings.RpcServer); } TestOutlookConnectivity.AddToPropertyBag(dictionary, "ItemTargetExtension", WorkDefinition.SerializeExtensionAttributes(dictionary2)); return(dictionary); }