Exemplo n.º 1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.unlockMoveTarget)
     {
         ActiveManager        activeManagerInstance = ActiveManager.GetActiveManagerInstance();
         DatabaseLocationInfo serverForDatabase     = activeManagerInstance.GetServerForDatabase(this.databaseObject.Guid);
         string serverFqdn = serverForDatabase.ServerFqdn;
         if (!this.DetectOnly)
         {
             UnlockMoveTargetUtil.UnlockMoveTarget(serverFqdn, this.databaseObject.Guid, this.mailboxGuid, this.organizationId);
             this.WriteResult(this.DataObject);
         }
     }
     else
     {
         StoreIntegrityCheckRequestFlags requestFlags           = this.GetRequestFlags();
         StoreIntegrityCheckJob          storeIntegrityCheckJob = StoreIntegrityCheckAdminRpc.CreateStoreIntegrityCheckJob(this.databaseObject, this.mailboxGuid, requestFlags, this.CorruptionType, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
         if (storeIntegrityCheckJob != null)
         {
             this.WriteResult(storeIntegrityCheckJob);
         }
     }
     TaskLogger.LogExit();
 }
Exemplo n.º 2
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            this.unlockMoveTarget = false;
            foreach (MailboxCorruptionType mailboxCorruptionType in this.CorruptionType)
            {
                MailboxCorruptionType mailboxCorruptionType2 = mailboxCorruptionType;
                if (mailboxCorruptionType2 == MailboxCorruptionType.LockedMoveTarget)
                {
                    this.unlockMoveTarget = true;
                }
            }
            if (this.unlockMoveTarget)
            {
                ADUser aduser = ((ADRecipient)base.GetDataObject <ADRecipient>(this.Mailbox, this.RecipientSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(this.Mailbox.ToString())))) as ADUser;
                if (this.CorruptionType.Length != 1)
                {
                    base.WriteError(new CorruptionTypeParameterIncompatibleException(MailboxCorruptionType.LockedMoveTarget.ToString()), ErrorCategory.InvalidArgument, this.CorruptionType);
                }
                if (UnlockMoveTargetUtil.IsValidLockedStatus(aduser.MailboxMoveStatus))
                {
                    base.WriteError(new UnableToUnlockMailboxDueToOutstandingMoveRequestException(this.Mailbox.ToString(), aduser.MailboxMoveStatus.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
                }
                ActiveManager        activeManagerInstance = ActiveManager.GetActiveManagerInstance();
                DatabaseLocationInfo serverForDatabase     = activeManagerInstance.GetServerForDatabase(this.databaseObject.Guid);
                if (!UnlockMoveTargetUtil.IsMailboxLocked(serverForDatabase.ServerFqdn, this.databaseObject.Guid, aduser.ExchangeGuid))
                {
                    base.WriteError(new MailboxIsNotLockedException(this.Mailbox.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
                }
            }
            if (!this.databaseObject.IsMailboxDatabase)
            {
                base.WriteError(new OnlineIsIntegException(this.databaseObject.Name, Strings.NotMailboxDatabase, null), ErrorCategory.InvalidArgument, null);
            }
            Guid guid;

            if (this.StoreMailbox != null && !Guid.TryParse(this.StoreMailbox.RawIdentity, out guid))
            {
                throw new ArgumentException("StoreMailbox");
            }
            TaskLogger.LogExit();
        }