protected override IConfigurable PrepareDataObject()
        {
            Container container = (Container)base.PrepareDataObject();

            container.SetId(ADSession.GetConfigurationUnitsRootForLocalForest());
            return(container);
        }
 public static ADObjectId GetCookieContainerId(IConfigurationSession notUsed)
 {
     return(ADSession.GetConfigurationUnitsRootForLocalForest());
 }
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            if (Datacenter.IsMultiTenancyEnabled())
            {
                this.isMultiTenancy = true;
            }
            else
            {
                this.isMultiTenancy = false;
            }
            this.exs = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.ExSWkGuid);
            if (this.exs == null)
            {
                base.ThrowTerminatingError(new ExSGroupNotFoundException(WellKnownGuid.ExSWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.exs);
            this.eoa = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EoaWkGuid);
            if (this.eoa == null)
            {
                base.ThrowTerminatingError(new ExOrgAdminSGroupNotFoundException(WellKnownGuid.EoaWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.eoa);
            this.era = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EraWkGuid);
            if (this.era == null)
            {
                base.ThrowTerminatingError(new ExOrgReadAdminSGroupNotFoundException(WellKnownGuid.EraWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.eoa);
            this.mas = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.MaSWkGuid);
            if (this.mas == null)
            {
                base.ThrowTerminatingError(new ExOrgReadAdminSGroupNotFoundException(WellKnownGuid.MaSWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.mas);
            this.epa = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EpaWkGuid);
            if (this.epa != null)
            {
                base.LogReadObject(this.epa);
            }
            this.ets = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.EtsWkGuid);
            if (this.ets == null)
            {
                base.ThrowTerminatingError(new ExTrustedSubsystemGroupNotFoundException(WellKnownGuid.EtsWkGuid), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.ets);
            this.delegatedSetupRG = base.ResolveExchangeGroupGuid <ADGroup>(WellKnownGuid.RgDelegatedSetupWkGuid);
            DelegatedSetupRoleGroupValueEnum delegatedSetupRoleGroupValue = VariantConfiguration.InvariantNoFlightingSnapshot.AD.DelegatedSetupRoleGroupValue.DelegatedSetupRoleGroupValue;

            if (delegatedSetupRoleGroupValue == DelegatedSetupRoleGroupValueEnum.NotExists || Datacenter.IsForefrontForOfficeDatacenter())
            {
                if (this.delegatedSetupRG != null)
                {
                    base.ThrowTerminatingError(new ExRbacRoleGroupInMultiTenantException(WellKnownGuid.RgDelegatedSetupWkGuid, "Delegated Setup"), ErrorCategory.InvalidData, null);
                }
            }
            else if (delegatedSetupRoleGroupValue == DelegatedSetupRoleGroupValueEnum.Exists)
            {
                if (this.delegatedSetupRG == null)
                {
                    base.ThrowTerminatingError(new ExRbacRoleGroupNotFoundException(WellKnownGuid.RgDelegatedSetupWkGuid, "Delegated Setup"), ErrorCategory.InvalidData, null);
                }
                base.LogReadObject(this.delegatedSetupRG);
            }
            this.autodiscoverContainer = this.ReadCriticalObjectFromRootOrg <ADContainer>(((ITopologyConfigurationSession)this.configurationSession).GetAutoDiscoverGlobalContainerId());
            this.orgContainer          = this.configurationSession.GetOrgContainer();
            base.LogReadObject(this.orgContainer);
            if (Datacenter.IsMultiTenancyEnabled())
            {
                ADObjectId configurationUnitsRootForLocalForest        = ADSession.GetConfigurationUnitsRootForLocalForest();
                ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsObjectId(configurationUnitsRootForLocalForest), 1413, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\InitializeExchangeConfigContainer.cs");
                this.confUnitsContainer = tenantConfigurationSession.Read <Container>(configurationUnitsRootForLocalForest);
                if (this.confUnitsContainer != null)
                {
                    base.LogReadObject(this.confUnitsContainer);
                }
            }
            this.addressingContainer = this.ReadCriticalObject <Container>(this.orgContainer.Id.GetChildId("Addressing"));
            this.meServicesContainer = this.configurationSession.GetExchangeConfigurationContainer();
            base.LogReadObject(this.meServicesContainer);
            ADObjectId childId = this.orgContainer.Id.GetChildId("Address Lists Container");

            this.addressListsContainer        = this.ReadCriticalObject <Container>(childId);
            this.offlineAddressListsContainer = this.ReadCriticalObject <Container>(childId.GetChildId("Offline Address Lists"));
            this.recipPoliciesContainer       = this.ReadCriticalObject <RecipientPoliciesContainer>(this.orgContainer.Id.GetChildId("Recipient Policies"));
            this.sitesContainer      = this.ReadCriticalObject <SitesContainer>(this.configurationSession.ConfigurationNamingContext.GetChildId("Sites"));
            this.administrativeGroup = ((ITopologyConfigurationSession)this.configurationSession).GetAdministrativeGroup();
            base.LogReadObject(this.administrativeGroup);
            this.arraysContainer = this.ReadCriticalObject <Container>(ClientAccessArray.GetParentContainer((ITopologyConfigurationSession)this.configurationSession));
            TaskLogger.LogExit();
        }