Exemple #1
0
 private void ValidatePSTImportParameters()
 {
     this.ValidateRemoteServerConstraint(this.RemoteServer.ToString(), MigrationBatchMessageSchema.MigrationJobRemoteServerHostName, "RemoteServer");
     this.endpoint = new PSTImportEndpoint
     {
         RemoteServer = this.RemoteServer,
         Credentials  = this.Credentials
     };
     this.targetMailbox = TestMigrationServerAvailability.DiscoverTestMailbox(this.TestMailbox, this.RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
 }
Exemple #2
0
        private void InternalProcessPublicFolder()
        {
            TestMigrationServerAvailabilityOutcome sendToPipeline;

            try
            {
                TestMigrationServerAvailability.VerifyPublicFolderConnection(base.DataProvider, (PublicFolderEndpoint)this.endpoint, this.SourceMailboxLegacyDN, this.PublicFolderDatabaseServerLegacyDN, this.targetMailbox);
                ExchangeConnectionSettings connectionSettings = this.endpoint.ConnectionSettings as ExchangeConnectionSettings;
                sendToPipeline = TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Success, this.SupportsCutover, connectionSettings);
            }
            catch (LocalizedException ex)
            {
                sendToPipeline = TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Failed, this.SupportsCutover, ex.LocalizedString, ex.ToString());
            }
            base.WriteObject(sendToPipeline);
        }
Exemple #3
0
 private void ValidatePublicFolderParameters()
 {
     this.ValidateRemoteServerConstraint(this.RPCProxyServer, MigrationBatchMessageSchema.MigrationJobExchangeRPCProxyServerHostName, "RpcProxyServer");
     if (!LegacyDN.IsValidLegacyDN(this.SourceMailboxLegacyDN))
     {
         this.WriteError(new InvalidLegacyExchangeDnValueException("SourceMailboxLegacyDN"));
     }
     if (!LegacyDN.IsValidLegacyDN(this.PublicFolderDatabaseServerLegacyDN))
     {
         this.WriteError(new InvalidLegacyExchangeDnValueException("PublicFolderDatabaseServerLegacyDN"));
     }
     this.endpoint = new PublicFolderEndpoint
     {
         RpcProxyServer        = this.RPCProxyServer,
         AuthenticationMethod  = this.Authentication,
         SourceMailboxLegacyDN = this.SourceMailboxLegacyDN,
         PublicFolderDatabaseServerLegacyDN = this.PublicFolderDatabaseServerLegacyDN,
         Credentials = this.Credentials
     };
     this.targetMailbox = TestMigrationServerAvailability.DiscoverPublicFolderTestMailbox(this.TestMailbox, this.ConfigurationSession, this.RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
 }
Exemple #4
0
 private void ValidateExchangeOutlookAnywhereParameters()
 {
     if (!this.Autodiscover)
     {
         this.ValidateRemoteServerConstraint(this.RPCProxyServer.ToString(), MigrationBatchMessageSchema.MigrationJobExchangeRPCProxyServerHostName, "RPCProxyServer");
         this.ValidateRemoteServerConstraint(this.ExchangeServer, MigrationBatchMessageSchema.MigrationJobExchangeRemoteServerHostName, "ExchangeServer");
         if (this.EmailAddress == SmtpAddress.Empty && string.IsNullOrEmpty(this.SourceMailboxLegacyDN))
         {
             this.WriteError(new MigrationPermanentException(Strings.MigrationMustSpecifyEmailOrMailboxDN));
         }
     }
     else
     {
         this.ValidateAutodiscoverParameters();
     }
     if (base.CurrentOrganizationId == null || OrganizationId.ForestWideOrgId.Equals(base.CurrentOrganizationId))
     {
         this.WriteError(new InvalidOrganizationException());
     }
     this.targetMailbox = TestMigrationServerAvailability.DiscoverTestMailbox(this.TestMailbox, this.RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
 }
Exemple #5
0
        private void InternalProcessExchangeOutlookAnywhere(IMigrationDataProvider dataProvider)
        {
            ExchangeOutlookAnywhereEndpoint exchangeOutlookAnywhereEndpoint = new ExchangeOutlookAnywhereEndpoint();

            try
            {
                if (this.Autodiscover)
                {
                    TestMigrationServerAvailabilityOutcome testMigrationServerAvailabilityOutcome = null;
                    try
                    {
                        exchangeOutlookAnywhereEndpoint.InitializeFromAutoDiscover(this.EmailAddress, this.Credentials);
                    }
                    catch (AutoDiscoverFailedConfigurationErrorException exception)
                    {
                        testMigrationServerAvailabilityOutcome = this.CreateAutodsicoverFailedOutcome(exception);
                    }
                    catch (AutoDiscoverFailedInternalErrorException exception2)
                    {
                        testMigrationServerAvailabilityOutcome = this.CreateAutodsicoverFailedOutcome(exception2);
                    }
                    if (testMigrationServerAvailabilityOutcome != null)
                    {
                        MigrationLogger.Log(MigrationEventType.Information, testMigrationServerAvailabilityOutcome.ToString(), new object[0]);
                        base.WriteObject(testMigrationServerAvailabilityOutcome);
                        return;
                    }
                }
                else
                {
                    exchangeOutlookAnywhereEndpoint.RpcProxyServer       = this.RPCProxyServer;
                    exchangeOutlookAnywhereEndpoint.Credentials          = this.Credentials;
                    exchangeOutlookAnywhereEndpoint.ExchangeServer       = this.ExchangeServer;
                    exchangeOutlookAnywhereEndpoint.AuthenticationMethod = this.Authentication;
                }
                IMigrationNspiClient nspiClient = MigrationServiceFactory.Instance.GetNspiClient(null);
                exchangeOutlookAnywhereEndpoint.NspiServer        = nspiClient.GetNewDSA(exchangeOutlookAnywhereEndpoint);
                exchangeOutlookAnywhereEndpoint.MailboxPermission = this.MailboxPermission;
                NspiMigrationDataReader nspiDataReader = exchangeOutlookAnywhereEndpoint.GetNspiDataReader(null);
                nspiDataReader.Ping();
                ExchangeOutlookAnywhereEndpoint.ValidateEndpoint(exchangeOutlookAnywhereEndpoint);
            }
            catch (MigrationTransientException ex)
            {
                MigrationLogger.Log(MigrationEventType.Warning, MigrationLogger.GetDiagnosticInfo(ex, null), new object[0]);
                base.WriteObject(TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Failed, this.SupportsCutover, ex.LocalizedString, ex.InternalError));
                return;
            }
            catch (MigrationPermanentException ex2)
            {
                MigrationLogger.Log(MigrationEventType.Error, MigrationLogger.GetDiagnosticInfo(ex2, null), new object[0]);
                base.WriteObject(TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Failed, this.SupportsCutover, ex2.LocalizedString, ex2.InternalError));
                return;
            }
            TestMigrationServerAvailabilityOutcome testMigrationServerAvailabilityOutcome2;

            try
            {
                TestMigrationServerAvailability.VerifyExchangeOutlookAnywhereConnection(dataProvider, exchangeOutlookAnywhereEndpoint, (string)this.EmailAddress, this.SourceMailboxLegacyDN, this.targetMailbox, !this.IsFieldSet("MailboxPermission"));
                testMigrationServerAvailabilityOutcome2 = TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Success, this.SupportsCutover, (ExchangeConnectionSettings)exchangeOutlookAnywhereEndpoint.ConnectionSettings);
            }
            catch (LocalizedException ex3)
            {
                string diagnosticInfo = MigrationLogger.GetDiagnosticInfo(ex3, null);
                MigrationLogger.Log(MigrationEventType.Error, diagnosticInfo, new object[0]);
                testMigrationServerAvailabilityOutcome2 = TestMigrationServerAvailabilityOutcome.Create(TestMigrationServerAvailabilityResult.Failed, this.SupportsCutover, ex3.LocalizedString, diagnosticInfo);
                testMigrationServerAvailabilityOutcome2.ConnectionSettings = (ExchangeConnectionSettings)exchangeOutlookAnywhereEndpoint.ConnectionSettings;
            }
            base.WriteObject(testMigrationServerAvailabilityOutcome2);
        }
Exemple #6
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            bool          flag         = false;
            MigrationType endpointType = this.DataObject.EndpointType;

            if (endpointType <= MigrationType.ExchangeOutlookAnywhere)
            {
                if (endpointType == MigrationType.IMAP)
                {
                    this.WriteParameterErrorIfSet("Credentials");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.ExchangeOutlookAnywhere)
                {
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    goto IL_2B4;
                }
            }
            else
            {
                if (endpointType == MigrationType.ExchangeRemoteMove)
                {
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Authentication");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.PSTImport)
                {
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Authentication");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.PublicFolder)
                {
                    this.WriteParameterErrorIfSet("RemoteServer");
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
            }
            base.WriteError(new InvalidEndpointTypeException(this.Identity.RawIdentity, this.DataObject.EndpointType.ToString()));
IL_2B4:
            if (base.IsFieldSet("MaxConcurrentMigrations") || base.IsFieldSet("MaxConcurrentIncrementalSyncs"))
            {
                Unlimited <int> unlimited  = base.IsFieldSet("MaxConcurrentMigrations") ? this.MaxConcurrentMigrations : this.DataObject.MaxConcurrentMigrations;
                Unlimited <int> unlimited2 = base.IsFieldSet("MaxConcurrentIncrementalSyncs") ? this.MaxConcurrentIncrementalSyncs : this.DataObject.MaxConcurrentIncrementalSyncs;
                if (unlimited2 > unlimited)
                {
                    base.WriteError(new MigrationMaxConcurrentIncrementalSyncsVerificationFailedException(unlimited2, unlimited));
                }
            }
            if (base.IsFieldSet("MaxConcurrentMigrations") && !this.MaxConcurrentMigrations.Equals(this.DataObject.MaxConcurrentMigrations))
            {
                this.DataObject.MaxConcurrentMigrations = this.MaxConcurrentMigrations;
                this.changed = true;
            }
            if (base.IsFieldSet("MaxConcurrentIncrementalSyncs") && !this.MaxConcurrentIncrementalSyncs.Equals(this.DataObject.MaxConcurrentIncrementalSyncs))
            {
                this.DataObject.MaxConcurrentIncrementalSyncs = this.MaxConcurrentIncrementalSyncs;
                this.changed = true;
            }
            if (base.IsFieldSet("Credentials") && (this.Credentials == null || !this.Credentials.Equals(this.DataObject.Credentials)))
            {
                this.DataObject.Credentials = this.Credentials;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("MailboxPermission") && this.MailboxPermission != this.DataObject.MailboxPermission)
            {
                this.DataObject.MailboxPermission = this.MailboxPermission;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("ExchangeServer") && !this.ExchangeServer.Equals(this.DataObject.ExchangeServer))
            {
                this.DataObject.ExchangeServer = this.ExchangeServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("RPCProxyServer") && !this.RpcProxyServer.Equals(this.DataObject.RpcProxyServer))
            {
                this.DataObject.RpcProxyServer = this.RpcProxyServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("Port") && !this.Port.Equals(this.DataObject.Port))
            {
                this.DataObject.Port = new int?(this.Port);
                this.changed         = true;
                flag = true;
            }
            if (base.IsFieldSet("Authentication") && !this.Authentication.Equals(this.DataObject.Authentication))
            {
                this.DataObject.Authentication = new AuthenticationMethod?(this.Authentication);
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("Security") && !this.Security.Equals(this.DataObject.Security))
            {
                this.DataObject.Security = new IMAPSecurityMechanism?(this.Security);
                this.changed             = true;
                flag = true;
            }
            if (base.IsFieldSet("RemoteServer") && !this.RemoteServer.Equals(this.DataObject.RemoteServer))
            {
                this.DataObject.RemoteServer = this.RemoteServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("NspiServer") && !this.NspiServer.Equals(this.DataObject.NspiServer))
            {
                this.DataObject.NspiServer = this.NspiServer;
                this.changed = true;
                flag         = true;
            }
            if (this.DataObject.EndpointType == MigrationType.PublicFolder && base.IsFieldSet("SourceMailboxLegacyDN") && !this.SourceMailboxLegacyDN.Equals(this.DataObject.SourceMailboxLegacyDN))
            {
                if (!LegacyDN.IsValidLegacyDN(this.SourceMailboxLegacyDN))
                {
                    base.WriteError(new InvalidLegacyExchangeDnValueException("SourceMailboxLegacyDN"));
                }
                this.DataObject.SourceMailboxLegacyDN = this.SourceMailboxLegacyDN;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("PublicFolderDatabaseServerLegacyDN") && !this.PublicFolderDatabaseServerLegacyDN.Equals(this.DataObject.PublicFolderDatabaseServerLegacyDN))
            {
                if (!LegacyDN.IsValidLegacyDN(this.PublicFolderDatabaseServerLegacyDN))
                {
                    base.WriteError(new InvalidLegacyExchangeDnValueException("PublicFolderDatabaseServerLegacyDN"));
                }
                this.DataObject.PublicFolderDatabaseServerLegacyDN = this.PublicFolderDatabaseServerLegacyDN;
                this.changed = true;
                flag         = true;
            }
            if (flag)
            {
                this.DataObject.LastModifiedTime = (DateTime)ExDateTime.UtcNow;
            }
            if (!this.SkipVerification)
            {
                MigrationEndpointBase migrationEndpointBase = MigrationEndpointBase.CreateFrom(this.DataObject);
                migrationEndpointBase.VerifyConnectivity();
                if (this.DataObject.EndpointType == MigrationType.ExchangeOutlookAnywhere)
                {
                    ExchangeOutlookAnywhereEndpoint exchangeOutlookAnywhereEndpoint = (ExchangeOutlookAnywhereEndpoint)migrationEndpointBase;
                    if (!string.IsNullOrEmpty(this.SourceMailboxLegacyDN) || this.EmailAddress != SmtpAddress.Empty || !string.IsNullOrEmpty(exchangeOutlookAnywhereEndpoint.EmailAddress))
                    {
                        MailboxData targetMailbox = TestMigrationServerAvailability.DiscoverTestMailbox(this.TestMailbox, ((MigrationADProvider)this.DataProvider.ADProvider).RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                        string      text          = (string)this.EmailAddress;
                        if (string.IsNullOrEmpty(text))
                        {
                            text = exchangeOutlookAnywhereEndpoint.EmailAddress;
                        }
                        TestMigrationServerAvailability.VerifyExchangeOutlookAnywhereConnection(this.DataProvider, exchangeOutlookAnywhereEndpoint, text, this.SourceMailboxLegacyDN, targetMailbox, false);
                        return;
                    }
                }
                else if (this.DataObject.EndpointType == MigrationType.PublicFolder)
                {
                    MailboxData mailboxData = TestMigrationServerAvailability.DiscoverPublicFolderTestMailbox(this.TestMailbox, this.ConfigurationSession, ((MigrationADProvider)this.DataProvider.ADProvider).RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                    TestMigrationServerAvailability.VerifyPublicFolderConnection(this.DataProvider, (PublicFolderEndpoint)migrationEndpointBase, this.SourceMailboxLegacyDN, this.PublicFolderDatabaseServerLegacyDN, mailboxData);
                }
            }
        }