示例#1
0
        private void FindOrganizationalUnit()
        {
            if (this.OrganizationalUnit == null)
            {
                return;
            }
            bool useConfigNC      = this.ConfigurationSession.UseConfigNC;
            bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog;

            this.ConfigurationSession.UseConfigNC = false;
            if (string.IsNullOrEmpty(this.ConfigurationSession.DomainController))
            {
                this.ConfigurationSession.UseGlobalCatalog = true;
            }
            try
            {
                this.organizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(this.OrganizationalUnit, this.ConfigurationSession, (base.CurrentOrganizationId != null) ? base.CurrentOrganizationId.OrganizationalUnit : null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.OrganizationalUnit.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.OrganizationalUnit.ToString())));
                RecipientTaskHelper.IsOrgnizationalUnitInOrganization(this.ConfigurationSession, base.CurrentOrganizationId, this.organizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
            }
            finally
            {
                this.ConfigurationSession.UseConfigNC      = useConfigNC;
                this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog;
            }
        }
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            ExchangeOrganizationalUnit exchangeOrganizationalUnit = null;

            if (base.Fields.IsModified("DefaultDistributionListOU"))
            {
                this.DataObject.DefaultDistributionListOU = ((this.defaultOU == null) ? null : this.defaultOU.Id);
                exchangeOrganizationalUnit = this.defaultOU;
            }
            else if (this.DataObject.IsChanged(RecipientTemplateProvisioningPolicySchema.DefaultDistributionListOU) && this.DataObject.DefaultDistributionListOU != null)
            {
                exchangeOrganizationalUnit = RecipientTaskHelper.ResolveOrganizationalUnitInOrganization(new OrganizationalUnitIdParameter(this.DataObject.DefaultDistributionListOU), this.ConfigurationSession, null, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ExchangeOrganizationalUnit>), ExchangeErrorCategory.Client, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
            }
            if (exchangeOrganizationalUnit != null)
            {
                OrganizationId organizationId = OrganizationId.ForestWideOrgId;
                if (this.ConfigurationSession is ITenantConfigurationSession)
                {
                    organizationId = TaskHelper.ResolveOrganizationId(this.DataObject.Id, ADProvisioningPolicy.RdnContainer, (ITenantConfigurationSession)this.ConfigurationSession);
                }
                RecipientTaskHelper.IsOrgnizationalUnitInOrganization(this.ConfigurationSession, organizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
            }
            TaskLogger.LogExit();
        }
示例#3
0
 protected override void PrepareRecipientObject(ADDynamicGroup group)
 {
     TaskLogger.LogEnter();
     base.PrepareRecipientObject(group);
     if (base.OrganizationalUnit == null && group[ADRecipientSchema.DefaultDistributionListOU] != null)
     {
         ADObjectId adobjectId = (ADObjectId)group[ADRecipientSchema.DefaultDistributionListOU];
         RecipientTaskHelper.ResolveOrganizationalUnitInOrganization(new OrganizationalUnitIdParameter(adobjectId), this.ConfigurationSession, base.CurrentOrganizationId, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ExchangeOrganizationalUnit>), ExchangeErrorCategory.ServerOperation, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
         group.SetId(adobjectId.GetChildId(base.Name));
     }
     if (this.RecipientContainer == null)
     {
         if (!base.Fields.IsModified(ADDynamicGroupSchema.RecipientContainer))
         {
             group.RecipientContainer = group.Id.Parent;
         }
     }
     else
     {
         bool useConfigNC      = this.ConfigurationSession.UseConfigNC;
         bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog;
         this.ConfigurationSession.UseConfigNC = false;
         if (string.IsNullOrEmpty(this.ConfigurationSession.DomainController))
         {
             this.ConfigurationSession.UseGlobalCatalog = true;
         }
         ExchangeOrganizationalUnit exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(this.RecipientContainer, this.ConfigurationSession, (base.CurrentOrganizationId != null) ? base.CurrentOrganizationId.OrganizationalUnit : null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.RecipientContainer.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.RecipientContainer.ToString())), ExchangeErrorCategory.Client);
         RecipientTaskHelper.IsOrgnizationalUnitInOrganization(this.ConfigurationSession, group.OrganizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
         this.ConfigurationSession.UseConfigNC      = useConfigNC;
         this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog;
         group.RecipientContainer = (ADObjectId)exchangeOrganizationalUnit.Identity;
     }
     group.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.DynamicDistributionGroup);
     TaskLogger.LogExit();
 }
示例#4
0
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            if (this.Identity != null && this.OrganizationalUnit != null && this.IgnoreDefaultScope)
            {
                base.ThrowTerminatingError(new ArgumentException(Strings.ErrorIdAndOUSetTogetherUnderIgnoreDefaultScope), ErrorCategory.InvalidArgument, null);
            }
            ExchangeOrganizationalUnit exchangeOrganizationalUnit = null;

            if (this.OrganizationalUnit != null)
            {
                bool useConfigNC      = this.ConfigurationSession.UseConfigNC;
                bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog;
                this.ConfigurationSession.UseConfigNC = false;
                if (string.IsNullOrEmpty(this.ConfigurationSession.DomainController))
                {
                    this.ConfigurationSession.UseGlobalCatalog = true;
                }
                try
                {
                    exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(this.OrganizationalUnit, this.ConfigurationSession, (base.CurrentOrganizationId != null) ? base.CurrentOrganizationId.OrganizationalUnit : null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.OrganizationalUnit.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.OrganizationalUnit.ToString())));
                    RecipientTaskHelper.IsOrgnizationalUnitInOrganization(this.ConfigurationSession, base.CurrentOrganizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                }
                finally
                {
                    this.ConfigurationSession.UseConfigNC      = useConfigNC;
                    this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog;
                }
            }
            if (exchangeOrganizationalUnit != null)
            {
                this.rootId = exchangeOrganizationalUnit.Id;
            }
            else
            {
                this.rootId = ((base.CurrentOrganizationId != null) ? base.CurrentOrganizationId.OrganizationalUnit : null);
            }
            if (this.UsnForReconciliationSearch >= 0L)
            {
                if (base.DomainController == null)
                {
                    base.ThrowTerminatingError(new ArgumentException(Strings.ErrorDomainControllerNotSpecifiedWithUsnForReconciliationSearch), ErrorCategory.InvalidArgument, null);
                }
                base.InternalResultSize = Unlimited <uint> .UnlimitedValue;
                base.OptionalIdentityData.AdditionalFilter = new ComparisonFilter(ComparisonOperator.GreaterThan, ADRecipientSchema.UsnCreated, this.UsnForReconciliationSearch);
            }
            TaskLogger.LogExit();
        }
示例#5
0
        internal static ADObjectId GetRecipientContainer(OrganizationalUnitIdParameter recipientContainer, IConfigurationSession cfgSession, OrganizationId organizationId, NewAddressBookBase.GetUniqueObject getDataObject, Task.ErrorLoggerDelegate writeError, Task.TaskVerboseLoggingDelegate writeVerbose)
        {
            bool useConfigNC      = cfgSession.UseConfigNC;
            bool useGlobalCatalog = cfgSession.UseGlobalCatalog;

            cfgSession.UseConfigNC      = false;
            cfgSession.UseGlobalCatalog = true;
            ExchangeOrganizationalUnit exchangeOrganizationalUnit;

            try
            {
                exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)getDataObject(recipientContainer, cfgSession, organizationId.OrganizationalUnit, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(recipientContainer.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(recipientContainer.ToString())), ExchangeErrorCategory.Client);
                RecipientTaskHelper.IsOrgnizationalUnitInOrganization(cfgSession, organizationId, exchangeOrganizationalUnit, writeVerbose, writeError);
            }
            finally
            {
                cfgSession.UseConfigNC      = useConfigNC;
                cfgSession.UseGlobalCatalog = useGlobalCatalog;
            }
            return(exchangeOrganizationalUnit.Id);
        }
示例#6
0
        // Token: 0x0600049E RID: 1182 RVA: 0x000108B0 File Offset: 0x0000EAB0
        protected override void InternalBeginProcessing()
        {
            base.InternalBeginProcessing();
            if (!string.IsNullOrEmpty(this.ExternalDirectoryObjectId))
            {
                ITenantRecipientSession tenantRecipientSession = base.TenantGlobalCatalogSession as ITenantRecipientSession;
                if (tenantRecipientSession != null)
                {
                    bool useGlobalCatalog = tenantRecipientSession.UseGlobalCatalog;
                    tenantRecipientSession.UseGlobalCatalog = false;
                    Result <ADRawEntry>[] array = null;
                    try
                    {
                        array = tenantRecipientSession.FindByExternalDirectoryObjectIds(new string[]
                        {
                            this.ExternalDirectoryObjectId
                        }, true, new ADPropertyDefinition[]
                        {
                            DeletedObjectSchema.LastKnownParent
                        });
                    }
                    finally
                    {
                        tenantRecipientSession.UseGlobalCatalog = useGlobalCatalog;
                    }
                    if (array != null)
                    {
                        for (int i = 0; i < array.Length; i++)
                        {
                            if (array[i].Error != ProviderError.NotFound || array[i].Data != null)
                            {
                                ADObjectId adobjectId = null;
                                if (array[i].Error == null)
                                {
                                    adobjectId = (ADObjectId)array[i].Data[DeletedObjectSchema.LastKnownParent];
                                }
                                if (array[i].Error != null || adobjectId == null || (adobjectId.DomainId != null && !adobjectId.IsDescendantOf(ADSession.GetDeletedObjectsContainer(adobjectId.DomainId))))
                                {
                                    base.ThrowTerminatingError(new DuplicateExternalDirectoryObjectIdException(this.Name, this.ExternalDirectoryObjectId), ExchangeErrorCategory.Client, null);
                                }
                            }
                        }
                    }
                }
            }
            bool useConfigNC       = this.ConfigurationSession.UseConfigNC;
            bool useGlobalCatalog2 = this.ConfigurationSession.UseGlobalCatalog;

            this.ConfigurationSession.UseConfigNC      = false;
            this.ConfigurationSession.UseGlobalCatalog = true;
            IConfigurationSession cfgSession = this.ConfigurationSession;

            if (!cfgSession.IsReadConnectionAvailable())
            {
                cfgSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, this.ConfigurationSession.SessionSettings, 623, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\NewAdObjectTask.cs");
                cfgSession.UseGlobalCatalog = true;
                cfgSession.UseConfigNC      = false;
            }
            try
            {
                ExchangeOrganizationalUnit exchangeOrganizationalUnit = null;
                if (this.OrganizationalUnit != null)
                {
                    exchangeOrganizationalUnit = base.ProvisioningCache.TryAddAndGetGlobalDictionaryValue <ExchangeOrganizationalUnit, string>(CannedProvisioningCacheKeys.OrganizationalUnitDictionary, this.OrganizationalUnit.RawIdentity, () => (ExchangeOrganizationalUnit)this.GetDataObject <ExchangeOrganizationalUnit>(this.OrganizationalUnit, cfgSession, (this.CurrentOrganizationId != null) ? this.CurrentOrganizationId.OrganizationalUnit : null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.OrganizationalUnit.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.OrganizationalUnit.ToString()))));
                }
                if (exchangeOrganizationalUnit != null)
                {
                    this.containerId = exchangeOrganizationalUnit.Id;
                }
                else if (base.CurrentOrganizationId != null && base.CurrentOrganizationId.OrganizationalUnit != null)
                {
                    this.containerId = base.CurrentOrganizationId.OrganizationalUnit;
                }
                else
                {
                    string defaultOUForRecipient = RecipientTaskHelper.GetDefaultOUForRecipient(base.ServerSettings.RecipientViewRoot);
                    if (string.IsNullOrEmpty(defaultOUForRecipient))
                    {
                        base.ThrowTerminatingError(new TaskArgumentException(Strings.ErrorCannotDiscoverDefaultOrganizationUnitForRecipient), ExchangeErrorCategory.Client, null);
                    }
                    exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(new OrganizationalUnitIdParameter(defaultOUForRecipient), cfgSession, null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(defaultOUForRecipient)), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(defaultOUForRecipient)), ExchangeErrorCategory.Client);
                    this.containerId           = exchangeOrganizationalUnit.Id;
                }
                if (exchangeOrganizationalUnit != null)
                {
                    RecipientTaskHelper.IsOrgnizationalUnitInOrganization(cfgSession, base.CurrentOrganizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                }
            }
            finally
            {
                this.ConfigurationSession.UseConfigNC      = useConfigNC;
                this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog2;
            }
        }