private MonadConnectionInfo DiscoverConnectionInfo() { SupportedVersionList supportedVersionList = null; MonadConnectionInfo result = new ConnectionRetryDiscoverer(this).DiscoverConnectionInfo(out supportedVersionList, (OrganizationType.LocalOnPremise == this.Type || OrganizationType.Cloud == this.Type || OrganizationType.RemoteOnPremise == this.Type) ? this.SlotVersion : string.Empty); if (this.Type == OrganizationType.Cloud) { if (supportedVersionList.Count == 0) { throw new SupportedVersionListFormatException(Strings.AtLeastOneVersionMustBeSupported); } if (supportedVersionList.IsSupported(this.SlotVersion)) { throw new VersionMismatchException(Strings.MicrosoftExchangeOnPremise, supportedVersionList); } } else if (this.Type == OrganizationType.RemoteOnPremise) { if (supportedVersionList == null || supportedVersionList.Count == 0) { throw new InvalidOperationException(Strings.SP1ConnectToRTMServerError); } if (!supportedVersionList.IsSupported(this.SlotVersion)) { throw new InvalidOperationException(Strings.IncampatibleVersionConnectionError(supportedVersionList.GetLatestVersion(), this.SlotVersion)); } } return(result); }
public MonadConnectionInfo DiscoverConnectionInfo(out SupportedVersionList supportedVersionList, string slotVersion) { if (string.IsNullOrEmpty(this.credentialKey) && !this.logonWithDefaultCredential) { throw new NotSupportedException(); } bool flag = false; MonadConnectionInfo monadConnectionInfo = this.DiscoverConnectionInfo(ref flag, out supportedVersionList, slotVersion); if (flag && monadConnectionInfo.Credentials != null) { CredentialHelper.SaveCredential(this.credentialKey, monadConnectionInfo.Credentials); } return(monadConnectionInfo); }
private MonadConnectionInfo DiscoverForestConnectionInfo(IUIService uiService, OrganizationSetting forestInfo) { SupportedVersionList supportedVersionList = null; switch (forestInfo.Type) { case OrganizationType.LocalOnPremise: return(new ConnectionRetryDiscoverer(uiService, OrganizationType.LocalOnPremise, Strings.MicrosoftExchangeOnPremise, PSConnectionInfoSingleton.GetRemotePowerShellUri(this.GetAutoDiscoveredServer()), true).DiscoverConnectionInfo(out supportedVersionList, string.Empty)); case OrganizationType.RemoteOnPremise: case OrganizationType.Cloud: return(new ConnectionRetryDiscoverer(forestInfo, uiService).DiscoverConnectionInfo(out supportedVersionList, string.Empty)); default: return(null); } }
private string AllocateSlot(SupportedVersionList supportedVersionList) { IEnumerable <Slot> source = from s in this.slots where supportedVersionList.IsSupported(s.Version) && !s.Removed && !this.IsInUse(s.Key) select s; if (source.Count <Slot>() > 0) { return(source.First <Slot>().Key); } IEnumerable <Slot> source2 = from s in this.slots where !s.Removed && !this.IsInUse(s.Key) select s; if (source2.Count <Slot>() > 0) { return(source2.First <Slot>().Key); } return(null); }
public string Add(string displayName, Uri uri, bool logonWithDefaultCredential, OrganizationType type, SupportedVersionList supportedVersionList) { if (!this.HasAvailableSlots) { throw new IndexOutOfRangeException("No more slots are available."); } OrganizationSetting organizationSetting = new OrganizationSetting(); organizationSetting.DisplayName = displayName; organizationSetting.Uri = uri; organizationSetting.LogonWithDefaultCredential = logonWithDefaultCredential; organizationSetting.Type = type; organizationSetting.Key = this.AllocateSlot(supportedVersionList); this.organizationSettings.Add(organizationSetting); if (type != OrganizationType.Cloud && !this.RecentServerUris.Contains(uri)) { this.RecentServerUris.Add(uri); } return(organizationSetting.Key); }
public List <Slot> GetCompatibleSlots(SupportedVersionList supportedVersionList) { return((from c in this.slots where supportedVersionList.IsSupported(c.Version) select c).ToList <Slot>()); }
public MonadConnectionInfo DiscoverConnectionInfo(ref bool rememberCredentialChecked, out SupportedVersionList supportedVersionList, string slotVersion) { this.rememberCredentialChecked = rememberCredentialChecked; this.slotVersion = slotVersion; MonadConnectionInfo result = this.DiscoverConnectionInfoInternal(); rememberCredentialChecked = this.rememberCredentialChecked; supportedVersionList = this.supportedVersionList; return(result); }