/// <summary> /// InternalProcessRecord method override /// </summary> protected override void InternalProcessRecord() { SPFarm farm = SPFarm.Local; if (null == farm) { ThrowTerminatingError(new InvalidOperationException("SharePoint server farm not found."), ErrorCategory.ResourceUnavailable, this); } AdministrationService service = farm.Services.GetValue <AdministrationService>(); if (null == service) { ThrowTerminatingError(new InvalidOperationException("SharePoint Identity Service not found."), ErrorCategory.ResourceUnavailable, this); } IdentityServiceApplication existingServiceApplication = service.Applications.GetValue <IdentityServiceApplication>(this.Name); if (null == existingServiceApplication) { ThrowTerminatingError(new InvalidOperationException("SharePoint Identity Service Application not found."), ErrorCategory.ResourceUnavailable, this); } if (this.ParameterSetName == AssemblyParameterSetName) { this.WriteObject(existingServiceApplication.GetAssemblyConfiguration()); } else if (this.ParameterSetName == ConfigurationParameterSetName) { this.WriteObject(existingServiceApplication.GetConnectionConfiguration(m_connection)); } else if (this.ParameterSetName == AllConfigurationParameterSetName) { this.WriteObject(existingServiceApplication.GetConnectionConfigurationList()); } else if (this.ParameterSetName == DomainParameterSetName) { this.WriteObject(existingServiceApplication.GetDomainConfiguration(m_domain)); } else if (this.ParameterSetName == AllDomainParameterSetName) { this.WriteObject(existingServiceApplication.GetDomainConfigurationList()); } else if (this.ParameterSetName == AllGlobalParameterSetName) { this.WriteObject(existingServiceApplication.FillGeneralParameters()); } else if (this.ParameterSetName == ReloadParameterSetName) { this.WriteObject(existingServiceApplication.Reload()); } else { throw new NotSupportedException("Parameter set not supported."); } }
/// <summary> /// Select method implementation /// </summary> public static IEnumerable <DomainConfigurationWrapper> Select(IdentityServiceApplication serviceapplication) { List <DomainConfigurationWrapper> lst = new List <DomainConfigurationWrapper>(); List <DomainConfiguration> src = serviceapplication.GetDomainConfigurationList().ToList <DomainConfiguration>(); foreach (DomainConfiguration dom in src) { lst.Add(new DomainConfigurationWrapper(dom.DisplayName, dom.DnsName, dom.Connection, dom.Enabled, dom.DisplayPosition)); } if (lst.Count == 0) // For Showing Footer Row { lst.Add(new DomainConfigurationWrapper(string.Empty, string.Empty, string.Empty, false, -1)); } return(lst); }