Exemplo n.º 1
0
        /// <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.");
            }
        }
Exemplo n.º 2
0
        /// <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);
            }
            this.WriteObject(existingServiceApplication.Reload());
        }