internal BulkAutomaticLink(MailboxInfoForLinking mailboxInfo, ContactLinkingLogger logger, IContactLinkingPerformanceTracker performanceTracker, IDirectoryPersonSearcher directoryPersonSearcher, ContactStoreForBulkContactLinking contactStoreForBulkContactLinking)
 {
     Util.ThrowOnNullArgument(mailboxInfo, "mailboxInfo");
     Util.ThrowOnNullArgument(logger, "logger");
     Util.ThrowOnNullArgument(performanceTracker, "performanceTracker");
     Util.ThrowOnNullArgument(directoryPersonSearcher, "directoryPersonSearcher");
     Util.ThrowOnNullArgument(contactStoreForBulkContactLinking, "contactStoreForBulkContactLinking");
     this.logger             = logger;
     this.performanceTracker = performanceTracker;
     this.contactStore       = contactStoreForBulkContactLinking;
     this.automaticLink      = new AutomaticLink(mailboxInfo, this.logger, this.performanceTracker, directoryPersonSearcher, this.contactStore);
 }
示例#2
0
        internal static void PerformContactLinkingAfterMigration(StoreSession storeSession)
        {
            MailboxSession mailboxSession = storeSession as MailboxSession;

            if (mailboxSession == null)
            {
                ContactLink.Tracer.TraceDebug(0L, "AutomaticLink::PerformContactLinkingAfterMigration. Skiping session as it is not a MailboxSession.");
                return;
            }
            ContactLink.Tracer.TraceDebug <MailboxSession>(0L, "StoreSession::PerformContactLinking. Starting linking for {0}.", mailboxSession);
            ExDateTime                        exDateTime                        = ExDateTime.Now.Add(AutomaticLink.AllocatedTimeSlotForLinkingOnMigration.Value);
            MailboxInfoForLinking             mailboxInfoForLinking             = MailboxInfoForLinking.CreateFromMailboxSession(mailboxSession);
            ContactLinkingPerformanceTracker  performanceTracker                = new ContactLinkingPerformanceTracker(mailboxSession);
            DirectoryPersonSearcher           directoryPersonSearcher           = new DirectoryPersonSearcher(mailboxSession.MailboxOwner);
            ContactStoreForBulkContactLinking contactStoreForBulkContactLinking = new ContactStoreForBulkContactLinking(mailboxSession, performanceTracker);
            ContactLinkingLogger              contactLinkingLogger              = new ContactLinkingLogger("PerformContactLinkingAfterMigration", mailboxInfoForLinking);
            bool flag = false;

            contactLinkingLogger.LogEvent(new SchemaBasedLogEvent <ContactLinkingLogSchema.MigrationStart>
            {
                {
                    ContactLinkingLogSchema.MigrationStart.DueTime,
                    (DateTime)exDateTime
                }
            });
            try
            {
                AutomaticLink.RefreshContactLinkingDefaultFolderIds(mailboxSession);
                AutomaticLink automaticLink = new AutomaticLink(mailboxInfoForLinking, contactLinkingLogger, performanceTracker, directoryPersonSearcher, contactStoreForBulkContactLinking);
                automaticLink.LinkAllExistingContactsTimeBound(exDateTime);
                flag = true;
            }
            catch (DefaultFolderNameClashException e)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e);
            }
            catch (AccessDeniedException e2)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e2);
            }
            catch (ConnectionFailedTransientException e3)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e3);
            }
            catch (FolderSaveTransientException e4)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e4);
            }
            catch (MailboxUnavailableException e5)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e5);
            }
            catch (ObjectNotFoundException e6)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e6);
            }
            catch (StorageTransientException e7)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e7);
            }
            catch (StoragePermanentException e8)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e8);
            }
            catch (Exception e9)
            {
                AutomaticLink.TraceAndLogExceptionDuringLinkingPostMigration(mailboxInfoForLinking, contactLinkingLogger, e9);
                throw;
            }
            finally
            {
                contactLinkingLogger.LogEvent(new SchemaBasedLogEvent <ContactLinkingLogSchema.MigrationEnd>
                {
                    {
                        ContactLinkingLogSchema.MigrationEnd.Success,
                        flag
                    }
                });
                ContactLink.Tracer.TraceDebug <MailboxInfoForLinking, bool>(0L, "AutomaticLink::PerformContactLinkingAfterMigration. Done processing {0}. Contact linking completed successfully: {1}", mailboxInfoForLinking, flag);
            }
        }