internal static bool DoesAnySubFolderResideInTargetMailbox(FolderRecWrapper folderRec, Guid targetMailboxGuid, List <FolderToMailboxMapping> folderToMailboxMap) { return(folderRec.IsTargetMailbox(targetMailboxGuid, delegate(string fullFolderName) { string text = PublicFolderMigrator.NormalizeFolderPath(folderRec.FullFolderName); HashSet <Guid> hashSet = null; if (!string.IsNullOrWhiteSpace(text)) { int num = text.Length; if (text.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { num = text.Length - 1; } foreach (FolderToMailboxMapping folderToMailboxMapping in folderToMailboxMap) { string text2 = folderToMailboxMapping.FolderName; text2 = ((text2.IndexOf('ÿ') > -1) ? text2.Replace('ÿ', "\\"[0]) : text2); if (text2.Length > num + 1 && text2[num] == "\\"[0] && text2.StartsWith(text, StringComparison.OrdinalIgnoreCase)) { if (hashSet == null) { hashSet = new HashSet <Guid>(); } hashSet.Add(folderToMailboxMapping.MailboxGuid); } } } return hashSet; })); }
private void InternalConfigureProviders(bool continueAfterConfiguringProviders) { if (this.publicFolderConfiguration.GetHierarchyMailboxInformation().Type != PublicFolderInformation.HierarchyType.InTransitMailboxGuid) { throw new PublicFolderMailboxesNotProvisionedForMigrationException(); } RequestStatisticsBase cachedRequestJob = base.CachedRequestJob; bool flag = cachedRequestJob.RequestStyle == RequestStyle.CrossOrg; LocalMailboxFlags localMailboxFlags = LocalMailboxFlags.LegacyPublicFolders; if (flag) { localMailboxFlags |= LocalMailboxFlags.PureMAPI; } this.sourceDatabases = new MapiSourceMailbox(localMailboxFlags); if (flag) { this.sourceDatabases.ConfigRPCHTTP(cachedRequestJob.RemoteMailboxLegacyDN, null, cachedRequestJob.RemoteMailboxServerLegacyDN, cachedRequestJob.OutlookAnywhereHostName, cachedRequestJob.RemoteCredential, true, cachedRequestJob.AuthenticationMethod != null && cachedRequestJob.AuthenticationMethod.Value == AuthenticationMethod.Ntlm); } else { ((IMailbox)this.sourceDatabases).Config(base.GetReservation(cachedRequestJob.SourceDatabase.ObjectGuid, ReservationFlags.Read), cachedRequestJob.SourceDatabase.ObjectGuid, cachedRequestJob.SourceDatabase.ObjectGuid, CommonUtils.GetPartitionHint(cachedRequestJob.OrganizationId), cachedRequestJob.SourceDatabase.ObjectGuid, MailboxType.SourceMailbox, null); } LocalizedString tracingId = flag ? MrsStrings.RPCHTTPPublicFoldersId(cachedRequestJob.RemoteMailboxLegacyDN) : MrsStrings.PublicFoldersId(cachedRequestJob.OrganizationId.ToString()); this.sourceDatabases.ConfigPublicFolders(cachedRequestJob.SourceDatabase); this.SourceDatabasesWrapper = new SourceMailboxWrapper(this.sourceDatabases, MailboxWrapperFlags.Source, tracingId); foreach (MailboxCopierBase mailboxCopierBase in this.GetAllCopiers()) { PublicFolderMigrator publicFolderMigrator = (PublicFolderMigrator)mailboxCopierBase; publicFolderMigrator.SetSourceDatabasesWrapper(this.SourceDatabasesWrapper); } base.ConfigureProviders(continueAfterConfiguringProviders); MailboxCopierBase rootMailboxContext = base.GetRootMailboxContext(); foreach (MailboxCopierBase mailboxCopierBase2 in this.GetAllCopiers()) { PublicFolderMigrator publicFolderMigrator2 = (PublicFolderMigrator)mailboxCopierBase2; if (!publicFolderMigrator2.IsRoot) { publicFolderMigrator2.SetHierarchyMailbox(rootMailboxContext.DestMailbox); } if (flag) { publicFolderMigrator2.ConfigTranslators(new PrincipalTranslator(this.SourceDatabasesWrapper.PrincipalMapper, publicFolderMigrator2.DestMailboxWrapper.PrincipalMapper), null); } } }
public override void Initialize(TransactionalRequestJob migrationRequestJob) { MrsTracer.Service.Function("PublicFolderMigrationJob.Initialize: SourceDatabase=\"{0}\", Flags={1}", new object[] { migrationRequestJob.SourceDatabase, migrationRequestJob.Flags }); TenantPublicFolderConfigurationCache.Instance.RemoveValue(migrationRequestJob.OrganizationId); this.publicFolderConfiguration = TenantPublicFolderConfigurationCache.Instance.GetValue(migrationRequestJob.OrganizationId); this.publicFolderMigrators = new Dictionary <Guid, PublicFolderMigrator>(); base.Initialize(migrationRequestJob); if (this.publicFolderConfiguration.GetHierarchyMailboxInformation().Type != PublicFolderInformation.HierarchyType.InTransitMailboxGuid) { return; } LocalizedString sourceTracingID = LocalizedString.Empty; MailboxCopierFlags mailboxCopierFlags = MailboxCopierFlags.PublicFolderMigration; bool flag = migrationRequestJob.RequestStyle == RequestStyle.CrossOrg; if (flag) { sourceTracingID = MrsStrings.RPCHTTPPublicFoldersId(migrationRequestJob.RemoteMailboxServerLegacyDN); mailboxCopierFlags |= MailboxCopierFlags.CrossOrg; } Guid hierarchyMailboxGuid = this.publicFolderConfiguration.GetHierarchyMailboxInformation().HierarchyMailboxGuid; PublicFolderMigrator value = new PublicFolderMigrator(this.publicFolderConfiguration, migrationRequestJob.FolderToMailboxMap, hierarchyMailboxGuid, mailboxCopierFlags | MailboxCopierFlags.Root, migrationRequestJob, this, sourceTracingID); this.publicFolderMigrators[hierarchyMailboxGuid] = value; foreach (FolderToMailboxMapping folderToMailboxMapping in migrationRequestJob.FolderToMailboxMap) { Guid mailboxGuid = folderToMailboxMapping.MailboxGuid; if (mailboxGuid != hierarchyMailboxGuid && !this.publicFolderMigrators.ContainsKey(mailboxGuid)) { PublicFolderMigrator value2 = new PublicFolderMigrator(this.publicFolderConfiguration, migrationRequestJob.FolderToMailboxMap, mailboxGuid, mailboxCopierFlags, migrationRequestJob, this, sourceTracingID); this.publicFolderMigrators[mailboxGuid] = value2; } } }
private Guid GetContentMailboxGuid(FolderRecWrapper sourceFolderRec) { return(sourceFolderRec.GetContentMailboxGuid(delegate(string fullFolderName) { fullFolderName = PublicFolderMigrator.NormalizeFolderPath(sourceFolderRec.FullFolderName); if (string.IsNullOrWhiteSpace(fullFolderName)) { return this.publicFolderConfiguration.GetHierarchyMailboxInformation().HierarchyMailboxGuid; } Guid result = this.publicFolderConfiguration.GetHierarchyMailboxInformation().HierarchyMailboxGuid; int num = 0; foreach (FolderToMailboxMapping folderToMailboxMapping in this.folderToMailboxMap) { string text = folderToMailboxMapping.FolderName; text = ((text.IndexOf('ÿ') > -1) ? text.Replace('ÿ', "\\"[0]) : text); if (fullFolderName.StartsWith(text, StringComparison.OrdinalIgnoreCase) && text.Length >= num) { num = text.Length; result = folderToMailboxMapping.MailboxGuid; } } return result; })); }
private bool DoesAnySubFolderResideInTargetMailbox(FolderRecWrapper folderRec) { return(PublicFolderMigrator.DoesAnySubFolderResideInTargetMailbox(folderRec, base.TargetMailboxGuid, this.folderToMailboxMap)); }