private void TestPstImportSubscription(IMigrationDataProvider dataProvider, PSTImportEndpoint endpoint, MailboxData targetMailbox) { PSTJobItemSubscriptionSettings jobItemSettings = PSTJobItemSubscriptionSettings.CreateFromProperties(this.FilePath); PSTImportAccessor pstimportAccessor = new PSTImportAccessor(dataProvider, null); pstimportAccessor.TestCreateSubscription(endpoint, null, jobItemSettings, targetMailbox, "PSTImport"); }
protected override void InternalProcessRecord() { MigrationSessionDataProvider migrationSessionDataProvider = (MigrationSessionDataProvider)base.DataSession; IMigrationDataProvider mailboxProvider = migrationSessionDataProvider.MailboxProvider; if (this.IsFieldSet("MigrationFeature") && migrationSessionDataProvider.MigrationSession.EnableFeatures(mailboxProvider, this.Features)) { this.changed = true; } MigrationConfig migrationConfig = migrationSessionDataProvider.MigrationSession.GetMigrationConfig(mailboxProvider); if (this.IsFieldSet("MaxNumberOfBatches") && this.MaxNumberOfBatches != migrationConfig.MaxNumberOfBatches) { migrationConfig.MaxNumberOfBatches = this.MaxNumberOfBatches; this.changed = true; } if (this.IsFieldSet("MaxConcurrentMigrations") && this.MaxConcurrentMigrations != migrationConfig.MaxConcurrentMigrations) { migrationConfig.MaxConcurrentMigrations = this.MaxConcurrentMigrations; this.changed = true; } if (this.changed) { migrationSessionDataProvider.MigrationSession.SetMigrationConfig(mailboxProvider, migrationConfig); } base.InternalProcessRecord(); }
internal static void VerifyPublicFolderConnection(IMigrationDataProvider dataProvider, PublicFolderEndpoint publicFolderEndpoint, string sourceMailboxLegacyDn, string publicFolderDatabaseServerLegacyDn, MailboxData mailboxData) { MrsPublicFolderAccessor mrsPublicFolderAccessor = new MrsPublicFolderAccessor(dataProvider, "TestMigrationServerAvailability"); using (Stream stream = new MemoryStream()) { using (StreamWriter streamWriter = new StreamWriter(stream)) { streamWriter.WriteLine("\"{0}\",\"{1}\"", "FolderPath", "TargetMailbox"); streamWriter.WriteLine("\"\\\",\"{0}\"", mailboxData.Name); streamWriter.Flush(); stream.Seek(0L, SeekOrigin.Begin); mrsPublicFolderAccessor.TestCreateSubscription(publicFolderEndpoint, mailboxData, stream); } } }
internal static bool VerifyExchangeOutlookAnywhereConnection(IMigrationDataProvider dataProvider, ExchangeOutlookAnywhereEndpoint outlookAnywhereEndpoint, string emailAddress, string sourceMailboxLegacyDN, MailboxData targetMailbox, bool discoverAdminPrivilege) { string mailboxDN; if (!string.IsNullOrEmpty(sourceMailboxLegacyDN)) { mailboxDN = sourceMailboxLegacyDN; } else if (!string.IsNullOrEmpty(emailAddress) && (!outlookAnywhereEndpoint.UseAutoDiscover || outlookAnywhereEndpoint.AutodiscoverResponse == null)) { NspiMigrationDataReader nspiDataReader = outlookAnywhereEndpoint.GetNspiDataReader(null); IMigrationDataRow recipient = nspiDataReader.GetRecipient(emailAddress); NspiMigrationDataRow nspiMigrationDataRow = recipient as NspiMigrationDataRow; if (nspiMigrationDataRow == null) { LocalizedString localizedErrorMessage = LocalizedString.Empty; InvalidDataRow invalidDataRow = recipient as InvalidDataRow; if (invalidDataRow != null && invalidDataRow.Error != null) { LocalizedString localizedErrorMessage2 = invalidDataRow.Error.LocalizedErrorMessage; localizedErrorMessage = invalidDataRow.Error.LocalizedErrorMessage; } throw new MigrationPermanentException(localizedErrorMessage); } mailboxDN = nspiMigrationDataRow.Recipient.GetPropertyValue <string>(PropTag.EmailAddress); } else { mailboxDN = outlookAnywhereEndpoint.AutodiscoverResponse.MailboxDN; } ExchangeJobItemSubscriptionSettings subscriptionSettings = ExchangeJobItemSubscriptionSettings.CreateFromProperties(mailboxDN, outlookAnywhereEndpoint.ExchangeServer, outlookAnywhereEndpoint.ExchangeServer, outlookAnywhereEndpoint.RpcProxyServer); bool flag = false; try { IL_C3: MRSMergeRequestAccessor mrsmergeRequestAccessor = new MRSMergeRequestAccessor(dataProvider, null, false); mrsmergeRequestAccessor.TestCreateSubscription(outlookAnywhereEndpoint, null, subscriptionSettings, targetMailbox, null, false); } catch (LocalizedException ex) { if (discoverAdminPrivilege && !flag && CommonUtils.GetExceptionSide(ex) == ExceptionSide.Source) { Exception ex2 = ex; while (ex2.InnerException != null) { ex2 = ex2.InnerException; } if (CommonUtils.ExceptionIs(ex2, new WellKnownException[] { WellKnownException.MapiLogonFailed })) { if (outlookAnywhereEndpoint.MailboxPermission == MigrationMailboxPermission.Admin) { outlookAnywhereEndpoint.MailboxPermission = MigrationMailboxPermission.FullAccess; } else { outlookAnywhereEndpoint.MailboxPermission = MigrationMailboxPermission.Admin; } flag = true; goto IL_C3; } } throw; } return(flag); }
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); }
internal static LocalizedException ProcessCsv(IMigrationDataProvider dataProvider, MigrationBatch batch, MigrationCsvSchemaBase schema, byte[] csvData) { MigrationBatchCsvProcessor migrationBatchCsvProcessor = (batch.MigrationType == MigrationType.PublicFolder) ? new PublicFolderMigrationBatchCsvProcessor((PublicFolderMigrationCsvSchema)schema, dataProvider) : new MigrationBatchCsvProcessor(schema); return(migrationBatchCsvProcessor.ProcessCsv(batch, csvData)); }