protected void PostExchange(ADObjectId alContainer)
        {
            IConfigurationSession configurationSession = base.CreateGlobalWritableConfigSession();
            bool skipRangedAttributes = configurationSession.SkipRangedAttributes;

            configurationSession.SkipRangedAttributes = true;
            try
            {
                ExchangeConfigurationContainerWithAddressLists exchangeConfigurationContainerWithAddressLists = configurationSession.GetExchangeConfigurationContainerWithAddressLists();
                if (exchangeConfigurationContainerWithAddressLists.LinkedAddressBookRootAttributesPresent())
                {
                    exchangeConfigurationContainerWithAddressLists.AddressBookRoots2.Add(alContainer);
                }
                base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(exchangeConfigurationContainerWithAddressLists, configurationSession, typeof(ExchangeConfigurationContainer)));
                configurationSession.Save(exchangeConfigurationContainerWithAddressLists);
                exchangeConfigurationContainerWithAddressLists.ResetChangeTracking();
                if (!AddressBookUtilities.IsTenantAddressList(configurationSession, alContainer))
                {
                    exchangeConfigurationContainerWithAddressLists.AddressBookRoots.Add(alContainer);
                    base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(exchangeConfigurationContainerWithAddressLists, configurationSession, typeof(ExchangeConfigurationContainer)));
                    configurationSession.Save(exchangeConfigurationContainerWithAddressLists);
                }
            }
            finally
            {
                configurationSession.SkipRangedAttributes = skipRangedAttributes;
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(configurationSession));
            }
        }
예제 #2
0
        private void PostExchange(ADObjectId defaultGal)
        {
            IConfigurationSession configurationSession = base.CreateGlobalWritableConfigSession();
            bool skipRangedAttributes = configurationSession.SkipRangedAttributes;

            configurationSession.SkipRangedAttributes = true;
            try
            {
                ExchangeConfigurationContainerWithAddressLists exchangeConfigurationContainerWithAddressLists = configurationSession.GetExchangeConfigurationContainerWithAddressLists();
                if (exchangeConfigurationContainerWithAddressLists.LinkedAddressBookRootAttributesPresent())
                {
                    exchangeConfigurationContainerWithAddressLists.DefaultGlobalAddressList2.Add(defaultGal);
                }
                base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(exchangeConfigurationContainerWithAddressLists, configurationSession, typeof(ExchangeConfigurationContainer)));
                configurationSession.Save(exchangeConfigurationContainerWithAddressLists);
                exchangeConfigurationContainerWithAddressLists.ResetChangeTracking();
                if (!AddressBookUtilities.IsTenantAddressList(configurationSession, defaultGal))
                {
                    try
                    {
                        exchangeConfigurationContainerWithAddressLists.DefaultGlobalAddressList.Add(defaultGal);
                        base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(exchangeConfigurationContainerWithAddressLists, configurationSession, typeof(ExchangeConfigurationContainer)));
                        configurationSession.Save(exchangeConfigurationContainerWithAddressLists);
                    }
                    catch (AdminLimitExceededException innerException)
                    {
                        throw new ADOperationException(Strings.ErrorTooManyGALsCreated, innerException);
                    }
                }
            }
            finally
            {
                configurationSession.SkipRangedAttributes = skipRangedAttributes;
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(configurationSession));
            }
        }