Exemple #1
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            OrganizationId organizationId = this.DataObject.OrganizationId;
            OrganizationalUnitIdParameter organizationalUnitIdParameter = null;

            if (base.Fields.IsModified("RecipientContainer"))
            {
                if (this.RecipientContainer == null)
                {
                    this.DataObject.RecipientContainer = null;
                }
                else
                {
                    organizationalUnitIdParameter = this.RecipientContainer;
                }
            }
            else if (this.DataObject.IsModified(AddressBookBaseSchema.RecipientContainer) && this.DataObject.RecipientContainer != null)
            {
                organizationalUnitIdParameter = new OrganizationalUnitIdParameter(this.DataObject.RecipientContainer);
            }
            if (organizationalUnitIdParameter != null)
            {
                if (base.GlobalConfigSession.IsInPreE14InteropMode())
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorCannotSetRecipientContainer), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                }
                this.DataObject.RecipientContainer = NewAddressBookBase.GetRecipientContainer(organizationalUnitIdParameter, (IConfigurationSession)base.DataSession, organizationId, new NewAddressBookBase.GetUniqueObject(base.GetDataObject <ExchangeOrganizationalUnit>), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
            }
            if (this.IsObjectStateChanged() && this.DataObject.HasMailboxManagerSetting)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorCanNotUpgradePolicyWithMailboxSetting(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Id);
            }
            if (this.IsObjectStateChanged() && this.DataObject.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007))
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorObjectNotManagableFromCurrentConsole(this.Identity.ToString(), this.DataObject.ExchangeVersion.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            if (!base.HasErrors)
            {
                if (this.DataObject.IsChanged(EmailAddressPolicySchema.Priority) && this.DataObject.Priority != 0)
                {
                    UpdateEmailAddressPolicy.PreparePriorityOfEapObjects(organizationId, this.DataObject, base.DataSession, new TaskExtendedErrorLoggingDelegate(this.WriteError), out this.affectedPolicies, out this.affectedPoliciesOriginalPriority);
                }
                if (!base.HasErrors && (this.DataObject.IsChanged(EmailAddressPolicySchema.RecipientFilter) || this.DataObject.IsChanged(EmailAddressPolicySchema.Priority) || this.DataObject.IsChanged(EmailAddressPolicySchema.RawEnabledEmailAddressTemplates) || this.DataObject.IsChanged(EmailAddressPolicySchema.DisabledEmailAddressTemplates) || this.DataObject.IsChanged(EmailAddressPolicySchema.NonAuthoritativeDomains) || this.DataObject.IsChanged(EmailAddressPolicySchema.RecipientContainer)))
                {
                    this.DataObject[EmailAddressPolicySchema.RecipientFilterApplied] = false;
                }
            }
            if (this.domainValidator == null || !this.domainValidator.OrganizationId.Equals(organizationId))
            {
                this.domainValidator = new UpdateEmailAddressPolicy.WritableDomainValidator(organizationId, this.ConfigurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            this.domainValidator.Validate(this.DataObject);
            TaskLogger.LogExit();
        }
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            OrganizationalUnitIdParameter organizationalUnitIdParameter = null;

            if (base.Fields.IsModified("RecipientContainer"))
            {
                if (this.RecipientContainer == null)
                {
                    this.DataObject.RecipientContainer = null;
                }
                else
                {
                    organizationalUnitIdParameter = this.RecipientContainer;
                }
            }
            else if (this.DataObject.IsModified(AddressBookBaseSchema.RecipientContainer) && this.DataObject.RecipientContainer != null)
            {
                organizationalUnitIdParameter = new OrganizationalUnitIdParameter(this.DataObject.RecipientContainer);
            }
            if (organizationalUnitIdParameter != null)
            {
                if (base.GlobalConfigSession.IsInPreE14InteropMode())
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorCannotSetRecipientContainer), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                }
                OrganizationId organizationId = this.DataObject.OrganizationId;
                this.DataObject.RecipientContainer = NewAddressBookBase.GetRecipientContainer(organizationalUnitIdParameter, this.ConfigurationSession, organizationId, new NewAddressBookBase.GetUniqueObject(base.GetDataObject <ExchangeOrganizationalUnit>), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
            }
            if (this.IsObjectStateChanged() && this.DataObject.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007))
            {
                TIdParameter identity = this.Identity;
                base.WriteError(new InvalidOperationException(Strings.ErrorObjectNotManagableFromCurrentConsole(identity.ToString(), this.DataObject.ExchangeVersion.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            if (!base.HasErrors)
            {
                if (this.DataObject.IsTopContainer)
                {
                    if (this.DataObject.IsModified(ADObjectSchema.Name) || this.DataObject.IsModified(AddressBookBaseSchema.DisplayName))
                    {
                        TIdParameter identity2 = this.Identity;
                        base.WriteError(new InvalidOperationException(Strings.ErrorInvalidOperationOnContainer(identity2.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                    }
                    this.ValidateBrokenRecipientFilterChange(null);
                }
                if (!base.HasErrors && (this.DataObject.IsChanged(AddressBookBaseSchema.RecipientFilter) || this.DataObject.IsChanged(AddressBookBaseSchema.RecipientContainer)))
                {
                    this.DataObject[AddressBookBaseSchema.RecipientFilterApplied] = false;
                }
            }
            TaskLogger.LogExit();
        }
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;

            this.containerId = base.CurrentOrgContainerId.GetDescendantId(EmailAddressPolicy.RdnEapContainerToOrganization);
            this.DataObject  = (EmailAddressPolicy)base.PrepareDataObject();
            if (!base.HasErrors)
            {
                this.DataObject.SetId(this.containerId.GetChildId(base.Name));
                if (!this.DataObject.IsModified(EmailAddressPolicySchema.Priority))
                {
                    this.DataObject.Priority = EmailAddressPolicyPriority.Lowest;
                }
                if (!base.HasErrors && (this.DataObject.Priority != 0 || !this.DataObject.IsModified(EmailAddressPolicySchema.Priority)))
                {
                    UpdateEmailAddressPolicy.PreparePriorityOfEapObjects(base.OrganizationId ?? OrganizationId.ForestWideOrgId, this.DataObject, base.DataSession, new TaskExtendedErrorLoggingDelegate(this.WriteError), out this.affectedPolicies, out this.affectedPoliciesOriginalPriority);
                }
                OrganizationalUnitIdParameter organizationalUnitIdParameter = null;
                if (base.Fields.IsModified("RecipientContainer"))
                {
                    if (this.RecipientContainer == null)
                    {
                        this.DataObject.RecipientContainer = null;
                    }
                    else
                    {
                        organizationalUnitIdParameter = this.RecipientContainer;
                    }
                }
                else if (this.DataObject.RecipientContainer != null)
                {
                    organizationalUnitIdParameter = new OrganizationalUnitIdParameter(this.DataObject.RecipientContainer);
                }
                if (organizationalUnitIdParameter != null)
                {
                    if (base.GlobalConfigSession.IsInPreE14InteropMode())
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorCannotSetRecipientContainer), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                    }
                    this.DataObject.RecipientContainer = NewAddressBookBase.GetRecipientContainer(organizationalUnitIdParameter, (IConfigurationSession)base.DataSession, base.OrganizationId ?? OrganizationId.ForestWideOrgId, new NewAddressBookBase.GetUniqueObject(base.GetDataObject <ExchangeOrganizationalUnit>), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                }
            }
            TaskLogger.LogExit();
            return(this.DataObject);
        }
Exemple #4
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            this.DataObject = (AddressBookBase)base.PrepareDataObject();
            if (!base.HasErrors)
            {
                if (!this.DataObject.IsModified(AddressBookBaseSchema.DisplayName))
                {
                    this.DataObject.DisplayName = base.Name;
                }
                ADObjectId containerId = this.GetContainerId();
                if (!base.HasErrors)
                {
                    this.DataObject.SetId(containerId.GetChildId(base.Name));
                }
            }
            OrganizationalUnitIdParameter organizationalUnitIdParameter = null;

            if (base.Fields.IsModified("RecipientContainer"))
            {
                if (this.RecipientContainer == null)
                {
                    this.DataObject.RecipientContainer = null;
                }
                else
                {
                    organizationalUnitIdParameter = this.RecipientContainer;
                }
            }
            else if (this.DataObject.RecipientContainer != null)
            {
                organizationalUnitIdParameter = new OrganizationalUnitIdParameter(this.DataObject.RecipientContainer);
            }
            if (organizationalUnitIdParameter != null)
            {
                if (base.GlobalConfigSession.IsInPreE14InteropMode())
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorCannotSetRecipientContainer), ErrorCategory.InvalidArgument, this.DataObject.Identity);
                }
                this.DataObject.RecipientContainer = NewAddressBookBase.GetRecipientContainer(organizationalUnitIdParameter, (IConfigurationSession)base.DataSession, base.OrganizationId ?? OrganizationId.ForestWideOrgId, new NewAddressBookBase.GetUniqueObject(base.GetDataObject <ExchangeOrganizationalUnit>), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
            }
            TaskLogger.LogExit();
            return(this.DataObject);
        }