Beispiel #1
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADUser aduser = (ADUser)base.PrepareDataObject();

            MailboxTaskHelper.BlockRemoveOrDisableIfLitigationHoldEnabled(aduser, new Task.ErrorLoggerDelegate(base.WriteError), true, this.IgnoreLegalHold.ToBool());
            MailboxTaskHelper.BlockRemoveOrDisableIfDiscoveryHoldEnabled(aduser, new Task.ErrorLoggerDelegate(base.WriteError), true, this.IgnoreLegalHold.ToBool());
            if (ComplianceConfigImpl.JournalArchivingHardeningEnabled)
            {
                MailboxTaskHelper.BlockRemoveOrDisableMailUserIfJournalArchiveEnabled(base.DataSession as IRecipientSession, this.ConfigurationSession, aduser, new Task.ErrorLoggerDelegate(base.WriteError), true, false);
            }
            if (!aduser.ExchangeVersion.IsOlderThan(ADUserSchema.ArchiveGuid.VersionAdded))
            {
                if (aduser.ArchiveGuid != Guid.Empty)
                {
                    if (!this.PreventRecordingPreviousDatabase)
                    {
                        aduser.DisabledArchiveGuid     = aduser.ArchiveGuid;
                        aduser.DisabledArchiveDatabase = aduser.ArchiveDatabase;
                    }
                    else
                    {
                        aduser.DisabledArchiveGuid     = Guid.Empty;
                        aduser.DisabledArchiveDatabase = null;
                    }
                }
                aduser.ArchiveGuid             = Guid.Empty;
                aduser.ArchiveName             = null;
                aduser.ArchiveDatabase         = null;
                aduser.ArchiveStatus           = (aduser.ArchiveStatus &= ~ArchiveStatusFlags.Active);
                aduser.AllowArchiveAddressSync = false;
            }
            if ("Archive" == base.ParameterSetName)
            {
                MailboxTaskHelper.ClearExchangeProperties(aduser, DisableMailUserBase <MailUserIdParameter> .MailboxMovePropertiesToReset);
                TaskLogger.Trace("DisableMailbox -Archive skipping PrepareDataObject", new object[0]);
                TaskLogger.LogExit();
                return(aduser);
            }
            int        recipientSoftDeletedStatus = aduser.RecipientSoftDeletedStatus;
            DateTime?  whenSoftDeleted            = aduser.WhenSoftDeleted;
            Guid       disabledArchiveGuid        = aduser.DisabledArchiveGuid;
            ADObjectId disabledArchiveDatabase    = aduser.DisabledArchiveDatabase;

            MailboxTaskHelper.ClearExchangeProperties(aduser, RecipientConstants.DisableMailUserBase_PropertiesToReset);
            aduser.SetExchangeVersion(null);
            aduser.OverrideCorruptedValuesWithDefault();
            aduser.propertyBag.SetField(ADRecipientSchema.RecipientSoftDeletedStatus, recipientSoftDeletedStatus);
            aduser.propertyBag.SetField(ADRecipientSchema.WhenSoftDeleted, whenSoftDeleted);
            if (disabledArchiveGuid != Guid.Empty)
            {
                aduser.propertyBag.SetField(ADUserSchema.DisabledArchiveGuid, disabledArchiveGuid);
                aduser.propertyBag.SetField(ADUserSchema.DisabledArchiveDatabase, disabledArchiveDatabase);
            }
            TaskLogger.LogExit();
            return(aduser);
        }
Beispiel #2
0
 protected override void InternalValidate()
 {
     this.latencyContext = ProvisioningPerformanceHelper.StartLatencyDetection(this);
     base.InternalValidate();
     MailboxTaskHelper.BlockRemoveOrDisableIfLitigationHoldEnabled(base.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), false, this.IgnoreLegalHold.ToBool());
     MailboxTaskHelper.BlockRemoveOrDisableIfDiscoveryHoldEnabled(base.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), false, this.IgnoreLegalHold.ToBool());
     if (ComplianceConfigImpl.JournalArchivingHardeningEnabled)
     {
         MailboxTaskHelper.BlockRemoveOrDisableMailUserIfJournalArchiveEnabled(base.DataSession as IRecipientSession, this.ConfigurationSession, base.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), false, this.isSyncOperation);
     }
 }