Esempio n. 1
0
        public void SetFederationTrustRefreshMetadata(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.SetNull <bool>("RefreshMetadata");
            base.RemotePowershellSession.RunCommand("Set-Federationtrust", sessionParameters);
        }
Esempio n. 2
0
        public IFederatedOrganizationIdentifier GetFederatedOrganizationIdentifier()
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.SetNull <bool>("IncludeExtendedDomainInfo");
            FederatedOrganizationIdWithDomainStatus federatedOrganizationIdWithDomainStatus = this.RemotePowershellSession.RunOneCommandSingleResult <FederatedOrganizationIdWithDomainStatus>("Get-FederatedOrganizationIdentifier", sessionParameters, true);

            if (federatedOrganizationIdWithDomainStatus != null)
            {
                return(new FederatedOrganizationIdentifier
                {
                    Enabled = federatedOrganizationIdWithDomainStatus.Enabled,
                    Domains = federatedOrganizationIdWithDomainStatus.Domains,
                    AccountNamespace = federatedOrganizationIdWithDomainStatus.AccountNamespace,
                    DelegationTrustLink = federatedOrganizationIdWithDomainStatus.DelegationTrustLink,
                    DefaultDomain = federatedOrganizationIdWithDomainStatus.DefaultDomain
                });
            }
            return(null);
        }
Esempio n. 3
0
        public override bool Configure(ITaskContext taskContext)
        {
            if (!base.Configure(taskContext))
            {
                return(false);
            }
            HybridConfiguration hybridConfigurationObject = taskContext.HybridConfigurationObject;
            SessionParameters   sessionParameters         = new SessionParameters();
            SessionParameters   sessionParameters2        = new SessionParameters();

            if (hybridConfigurationObject.MoveMailboxEnabled != this.onPremOrgRel.MailboxMoveEnabled)
            {
                sessionParameters.Set("MailboxMoveEnabled", hybridConfigurationObject.MoveMailboxEnabled);
            }
            if (hybridConfigurationObject.FreeBusySharingEnabled != this.onPremOrgRel.FreeBusyAccessEnabled || hybridConfigurationObject.FreeBusySharingEnabled != this.tenantOrgRel.FreeBusyAccessEnabled)
            {
                sessionParameters.Set("FreeBusyAccessEnabled", hybridConfigurationObject.FreeBusySharingEnabled);
                sessionParameters2.Set("FreeBusyAccessEnabled", hybridConfigurationObject.FreeBusySharingEnabled);
            }
            if (hybridConfigurationObject.FreeBusySharingEnabled && (this.onPremOrgRel.FreeBusyAccessLevel != FreeBusyAccessLevel.LimitedDetails || this.tenantOrgRel.FreeBusyAccessLevel != FreeBusyAccessLevel.LimitedDetails))
            {
                sessionParameters.Set("FreeBusyAccessLevel", FreeBusyAccessLevel.LimitedDetails);
                sessionParameters2.Set("FreeBusyAccessLevel", FreeBusyAccessLevel.LimitedDetails);
            }
            if (hybridConfigurationObject.OnlineArchiveEnabled != this.onPremOrgRel.ArchiveAccessEnabled)
            {
                sessionParameters.Set("ArchiveAccessEnabled", hybridConfigurationObject.OnlineArchiveEnabled);
            }
            if (hybridConfigurationObject.MailtipsEnabled != this.onPremOrgRel.MailTipsAccessEnabled || hybridConfigurationObject.MailtipsEnabled != this.tenantOrgRel.MailTipsAccessEnabled)
            {
                sessionParameters.Set("MailTipsAccessEnabled", hybridConfigurationObject.MailtipsEnabled);
                sessionParameters2.Set("MailTipsAccessEnabled", hybridConfigurationObject.MailtipsEnabled);
            }
            if (hybridConfigurationObject.MailtipsEnabled && (this.onPremOrgRel.MailTipsAccessLevel != MailTipsAccessLevel.All || this.tenantOrgRel.MailTipsAccessLevel != MailTipsAccessLevel.All))
            {
                sessionParameters.Set("MailTipsAccessLevel", MailTipsAccessLevel.All);
                sessionParameters2.Set("MailTipsAccessLevel", MailTipsAccessLevel.All);
            }
            if (hybridConfigurationObject.MessageTrackingEnabled != this.onPremOrgRel.DeliveryReportEnabled || hybridConfigurationObject.MessageTrackingEnabled != this.tenantOrgRel.DeliveryReportEnabled)
            {
                sessionParameters.Set("DeliveryReportEnabled", hybridConfigurationObject.MessageTrackingEnabled);
                sessionParameters2.Set("DeliveryReportEnabled", hybridConfigurationObject.MessageTrackingEnabled);
            }
            if (hybridConfigurationObject.PhotosEnabled != this.onPremOrgRel.PhotosEnabled || hybridConfigurationObject.PhotosEnabled != this.tenantOrgRel.PhotosEnabled)
            {
                sessionParameters.Set("PhotosEnabled", hybridConfigurationObject.PhotosEnabled);
                sessionParameters2.Set("PhotosEnabled", hybridConfigurationObject.PhotosEnabled);
            }
            string text = (this.onPremOrgRel.TargetOwaURL != null) ? this.onPremOrgRel.TargetOwaURL.ToString() : string.Empty;

            if (hybridConfigurationObject.OwaRedirectionEnabled || !string.IsNullOrEmpty(text))
            {
                if (hybridConfigurationObject.OwaRedirectionEnabled)
                {
                    IEnumerable <IAcceptedDomain> acceptedDomains = taskContext.Parameters.Get <IEnumerable <IAcceptedDomain> >("_tenantAcceptedDomains");
                    if (!string.IsNullOrEmpty(text))
                    {
                        if (!this.ValidateOwaUri(text, acceptedDomains))
                        {
                            sessionParameters.Set("TargetOwaURL", this.GetDefaultOwaUri(acceptedDomains, this.fedOrgId));
                        }
                    }
                    else
                    {
                        sessionParameters.Set("TargetOwaURL", this.GetDefaultOwaUri(acceptedDomains, this.fedOrgId));
                    }
                }
                else
                {
                    sessionParameters.SetNull <string>("TargetOwaURL");
                }
            }
            if (sessionParameters.Count > 0)
            {
                OrganizationRelationship organizationRelationship = taskContext.Parameters.Get <OrganizationRelationship>("_onPremOrgRel");
                base.OnPremisesSession.SetOrganizationRelationship(organizationRelationship.Identity, sessionParameters);
                List <string> list = new List <string>();
                string        item = taskContext.Parameters.Get <string>("_hybridDomain");
                list.Add(item);
                this.onPremOrgRel = TaskCommon.GetOrganizationRelationship(taskContext.OnPremisesSession, TaskCommon.GetOnPremOrgRelationshipName(this.OnPremOrgConfig), list);
                taskContext.Parameters.Set <OrganizationRelationship>("_onPremOrgRel", this.onPremOrgRel);
            }
            if (sessionParameters2.Count > 0)
            {
                OrganizationRelationship organizationRelationship2 = taskContext.Parameters.Get <OrganizationRelationship>("_tenantOrgRel");
                base.TenantSession.SetOrganizationRelationship(organizationRelationship2.Identity, sessionParameters2);
                IEnumerable <string> domains = taskContext.Parameters.Get <IEnumerable <string> >("_hybridDomainList");
                this.tenantOrgRel = TaskCommon.GetOrganizationRelationship(taskContext.TenantSession, TaskCommon.GetTenantOrgRelationshipName(this.OnPremOrgConfig), domains);
                taskContext.Parameters.Set <OrganizationRelationship>("_onPremOrgRel", this.tenantOrgRel);
            }
            this.ConfigureAvailabilityAddressSpace(taskContext);
            return(true);
        }