internal static void RegisterMigrationBatch(Task task, MailboxSession mailboxSession, OrganizationId organizationId, bool failIfNotConnected, bool refresh = false) { string serverFqdn = mailboxSession.MailboxOwner.MailboxInfo.Location.ServerFqdn; Guid mdbGuid = mailboxSession.MdbGuid; string mailboxOwnerLegacyDN = mailboxSession.MailboxOwnerLegacyDN; ADObjectId organizationName = organizationId.OrganizationalUnit ?? new ADObjectId(); int num = 2; for (int i = 1; i <= num; i++) { try { MigrationNotificationRpcStub migrationNotificationRpcStub = new MigrationNotificationRpcStub(serverFqdn); migrationNotificationRpcStub.RegisterMigrationBatch(new RegisterMigrationBatchArgs(mdbGuid, mailboxOwnerLegacyDN, organizationName, refresh)); break; } catch (MigrationServiceRpcException ex) { ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_MigrationServiceConnectionError, new string[] { serverFqdn, ex.Message }); if (i == num && failIfNotConnected) { MigrationLogger.Log(MigrationEventType.Warning, MigrationLogger.GetDiagnosticInfo(ex, null), new object[0]); task.WriteError(new LocalizedException(Strings.MigrationOperationFailed, null), ExchangeErrorCategory.Client, null); } } } }
internal static MigrationJob GetMigrationJobByBatchId(Task task, MigrationBatchDataProvider batchProvider, MigrationBatchId migrationBatchId, bool skipCorrupt, bool failIfNotFound = true) { MigrationJob migrationJob = null; Exception ex = null; try { migrationJob = batchProvider.JobCache.GetJob(migrationBatchId); } catch (PropertyErrorException ex2) { ex = ex2; } catch (InvalidDataException ex3) { ex = ex3; } if (ex != null) { MigrationLogger.Log(MigrationEventType.Warning, MigrationLogger.GetDiagnosticInfo(ex, null), new object[0]); task.WriteError(new MigrationPermanentException(Strings.MigrationJobCorrupted, ex), ExchangeErrorCategory.Client, null); } if (migrationJob != null && migrationJob.Status == MigrationJobStatus.Corrupted && skipCorrupt) { migrationJob = null; } if (migrationJob == null && failIfNotFound) { MigrationObjectTaskBase <TIdentityParameter> .WriteJobNotFoundError(task, migrationBatchId.ToString()); } return(migrationJob); }
private void WriteError(LocalizedException exception) { MigrationLogger.Log(MigrationEventType.Warning, MigrationLogger.GetDiagnosticInfo(exception, null), new object[0]); base.WriteError(exception, (ErrorCategory)1000, null); }
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); }