Example #1
0
        private void VerifyLegacyPublicFolderDatabaseLocked()
        {
            PublicFolderEndpoint publicFolderEndpoint = (PublicFolderEndpoint)this.DataObject.SourceEndpoint;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                IMailbox mailbox;
                if (publicFolderEndpoint != null)
                {
                    mailbox = disposeGuard.Add <IMailbox>(publicFolderEndpoint.ConnectToSourceDatabase());
                }
                else
                {
                    DatabaseIdParameter  id = DatabaseIdParameter.Parse(this.DataObject.SourcePublicFolderDatabase);
                    PublicFolderDatabase publicFolderDatabase = (PublicFolderDatabase)base.GetDataObject <PublicFolderDatabase>(id, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(this.DataObject.SourcePublicFolderDatabase)), new LocalizedString?(Strings.ErrorDatabaseNotUnique(this.DataObject.SourcePublicFolderDatabase)));
                    mailbox = disposeGuard.Add <IMailbox>(PublicFolderEndpoint.ConnectToLocalSourceDatabase(publicFolderDatabase.ExchangeObjectId));
                }
                try
                {
                    bool flag;
                    mailbox.SetInTransitStatus(InTransitStatus.MoveSource, out flag);
                    mailbox.SetInTransitStatus(InTransitStatus.NotInTransit, out flag);
                }
                catch (SourceMailboxAlreadyBeingMovedTransientException)
                {
                    base.WriteError(new MigrationBatchCannotBeCompletedException(Strings.CompletePublicFolderMigrationBatchRequiresSourceLockDown));
                }
            }
        }
Example #2
0
        protected override void InternalValidate()
        {
            this.ResetForParametersFromPipeline();
            SearchTestResult searchTestResult = SearchTestResult.DefaultSearchTestResult;
            Exception        ex = null;

            try
            {
                if (this.Identity != null)
                {
                    base.InternalValidate();
                    ADUser dataObject = this.DataObject;
                    searchTestResult = this.GetTestResultFromMailbox(dataObject);
                    this.CheckDatabaseRecoveryAndIndexEnabled(this.GetMailboxDatabase(DatabaseIdParameter.Parse(dataObject.Database.Name)), searchTestResult);
                    this.WriteProgress(Strings.TestSearchCurrentMailbox(dataObject.DisplayName));
                    this.monitor.AddMonitoringEvent(searchTestResult, Strings.TestSearchCurrentMailbox(dataObject.DisplayName));
                    this.searchTestResults.Add(searchTestResult);
                }
                else
                {
                    List <MailboxDatabase> list = new List <MailboxDatabase>(1);
                    if (this.MailboxDatabase != null)
                    {
                        MailboxDatabase mailboxDatabase = this.GetMailboxDatabase(this.MailboxDatabase);
                        list.Add(mailboxDatabase);
                    }
                    else
                    {
                        if (this.Server == null)
                        {
                            this.Server = ServerIdParameter.Parse(Environment.MachineName);
                        }
                        Server server = this.GetServer(this.Server);
                        foreach (MailboxDatabase item in server.GetMailboxDatabases())
                        {
                            list.Add(item);
                        }
                        if (list.Count == 0)
                        {
                            throw new RecipientTaskException(Strings.TestSearchServerNoMdbs(server.Name));
                        }
                    }
                    foreach (MailboxDatabase mailboxDatabase2 in list)
                    {
                        searchTestResult = this.GetTestResultFromMailboxDatabase(mailboxDatabase2);
                        this.CheckDatabaseRecoveryAndIndexEnabled(mailboxDatabase2, searchTestResult);
                        this.WriteProgress(Strings.TestSearchCurrentMDB(mailboxDatabase2.Name));
                        this.monitor.AddMonitoringEvent(searchTestResult, Strings.TestSearchCurrentMDB(mailboxDatabase2.Name));
                        this.searchTestResults.Add(searchTestResult);
                    }
                }
            }
            catch (ADTransientException ex2)
            {
                ex = ex2;
            }
            catch (ADExternalException ex3)
            {
                ex = ex3;
            }
            catch (DatabaseNotFoundException ex4)
            {
                ex = ex4;
            }
            catch (ServerNotFoundException ex5)
            {
                ex = ex5;
            }
            catch (ObjectNotFoundException ex6)
            {
                ex = ex6;
            }
            catch (StorageTransientException ex7)
            {
                ex = ex7;
            }
            catch (StoragePermanentException ex8)
            {
                ex = ex8;
            }
            catch (RecipientTaskException ex9)
            {
                ex = ex9;
            }
            finally
            {
                if (ex is StorageTransientException || ex is StoragePermanentException)
                {
                    searchTestResult.SetErrorTestResult(EventId.ActiveManagerError, new LocalizedString(ex.Message));
                    this.WriteTestResult(searchTestResult);
                    base.WriteError(ex, ErrorCategory.ResourceUnavailable, null);
                }
                else if (ex != null)
                {
                    searchTestResult.SetErrorTestResult(EventId.ADError, new LocalizedString(ex.Message));
                    this.WriteTestResult(searchTestResult);
                    base.WriteError(ex, ErrorCategory.ResourceUnavailable, null);
                }
            }
        }