// Token: 0x0600050C RID: 1292 RVA: 0x00025DFC File Offset: 0x00023FFC
 public void MoveToArchiveDumpster(DefaultFolderType folderType, List <ItemData> itemsToMove, ElcSubAssistant assistant, FolderArchiver folderArchiver, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal)
 {
     foldersWithErrors  = new List <string>();
     newMoveErrorsTotal = 0;
     if (this.archiveMailboxSession == null)
     {
         LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor>((long)this.GetHashCode(), "{0}: Could not open archive session for this mailbox", this);
         return;
     }
     assistant.EnableLoadTrackingOnSession(this.archiveMailboxSession);
     try
     {
         using (Folder folder = Folder.Bind(this.primaryMailboxSession, folderType))
         {
             using (Folder folder2 = Folder.Bind(this.archiveMailboxSession, folderType))
             {
                 if (folder2 != null)
                 {
                     LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, DefaultFolderType>((long)this.GetHashCode(), "{0}: Was able to open target folder in the archive dumpster of type {1}. Will proceed to move in batches.", this, folderType);
                     this.ExpireInBatches(itemsToMove, folder, folder2, assistant, ExpirationExecutor.Action.MoveToArchiveDumpster, totalFailuresSoFar, ref allExceptionsSoFar, out foldersWithErrors, out newMoveErrorsTotal);
                 }
                 else
                 {
                     LocalArchiveProcessor.Tracer.TraceWarning <LocalArchiveProcessor, DefaultFolderType>((long)this.GetHashCode(), "{0}: Unable to open target folder in the archive dumpster of type {1}. Will not move anything to it (obviously).", this, folderType);
                 }
             }
         }
     }
     catch (ObjectNotFoundException arg)
     {
         LocalArchiveProcessor.Tracer.TraceError <LocalArchiveProcessor, ObjectNotFoundException>((long)this.GetHashCode(), "{0}: Dumpster folder does not exist in archive. Skipping move to archive dumpster for this run. Exception: {1}", this, arg);
     }
 }
Exemple #2
0
        // Token: 0x060006A5 RID: 1701 RVA: 0x00032CB8 File Offset: 0x00030EB8
        private void CollectItemsInFolder(DefaultFolderType folderToCollect)
        {
            EHAHiddenFolderCleanupEnforcer.Tracer.TraceDebug <EHAHiddenFolderCleanupEnforcer, DefaultFolderType>((long)this.GetHashCode(), "{0}: CollectItemsInFolder: folderToCollect={1}.", this, folderToCollect);
            StoreId storeId = this.folderIdsToProcess[folderToCollect];
            int     num     = 0;
            int     num2    = this.ItemsLeftToCollect();

            if (storeId != null)
            {
                using (Folder folder = Folder.Bind(base.MailboxDataForTags.MailboxSession, storeId))
                {
                    int num3 = base.FolderItemTypeCount(folder, ItemQueryType.None);
                    base.SysCleanupSubAssistant.ThrottleStoreCall();
                    if (num3 <= 0 || num3 <= num2)
                    {
                        EHAHiddenFolderCleanupEnforcer.Tracer.TraceDebug <EHAHiddenFolderCleanupEnforcer, DefaultFolderType, int>((long)this.GetHashCode(), "{0}: Deleting {1} folder with {2} items", this, folderToCollect, num3);
                        num = num3;
                        folder.Load(new PropertyDefinition[]
                        {
                            FolderSchema.ExtendedSize
                        });
                        object obj = folder.TryGetProperty(FolderSchema.ExtendedSize);
                        if (obj is long)
                        {
                            long num4 = (long)obj;
                            base.TagExpirationExecutor.AddToDoomedHardDeleteList(new ItemData(folder.Id, (int)num4), true);
                        }
                    }
                    else
                    {
                        base.SysCleanupSubAssistant.ThrottleStoreCall();
                        using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, null, EHAHiddenFolderCleanupEnforcer.PropertyColumns.PropertyDefinitions))
                        {
                            queryResult.SeekToOffset(SeekReference.OriginBeginning, 0);
                            bool flag = true;
                            while (flag)
                            {
                                int num5 = num2 - num;
                                if (num5 > 0)
                                {
                                    object[][] rows = queryResult.GetRows(num5, out flag);
                                    foreach (object[] rawProperties in rows)
                                    {
                                        PropertyArrayProxy propertyArrayProxy = new PropertyArrayProxy(EHAHiddenFolderCleanupEnforcer.PropertyColumns, rawProperties);
                                        EHAHiddenFolderCleanupEnforcer.Tracer.TraceDebug <EHAHiddenFolderCleanupEnforcer, VersionedId, DefaultFolderType>((long)this.GetHashCode(), "{0}: Deleting item id [{1}] in folder {2} ", this, (VersionedId)propertyArrayProxy[ItemSchema.Id], folderToCollect);
                                        base.TagExpirationExecutor.AddToDoomedHardDeleteList(new ItemData((VersionedId)propertyArrayProxy[ItemSchema.Id], (StoreObjectId)propertyArrayProxy[StoreObjectSchema.ParentItemId], (int)propertyArrayProxy[ItemSchema.Size]), true);
                                    }
                                    num += rows.Length;
                                }
                                else
                                {
                                    flag = false;
                                }
                            }
                        }
                    }
                }
            }
            this.IncrementFolderCollectCount(folderToCollect, num);
        }
        // Token: 0x060006B6 RID: 1718 RVA: 0x0003364C File Offset: 0x0003184C
        private bool EnlistItem(PropertyArrayProxy itemProperties, DefaultFolderType folderTypeToCollect)
        {
            if (!(itemProperties[ItemSchema.Id] is VersionedId))
            {
                MigrateToArchiveEnforcer.Tracer.TraceError <MigrateToArchiveEnforcer>((long)this.GetHashCode(), "{0}: We could not get id of this item. Skipping it.", this);
                return(true);
            }
            StoreObjectId storeObjectId = itemProperties[StoreObjectSchema.ParentItemId] as StoreObjectId;

            if (storeObjectId == null)
            {
                MigrateToArchiveEnforcer.Tracer.TraceError <MigrateToArchiveEnforcer>((long)this.GetHashCode(), "{0}: We could not get parent id of this item. Skipping it.", this);
                return(true);
            }
            base.TagExpirationExecutor.AddToDoomedMoveToArchiveList(new ItemData((VersionedId)itemProperties[ItemSchema.Id], storeObjectId, (int)itemProperties[ItemSchema.Size]));
            if (folderTypeToCollect == DefaultFolderType.Inbox)
            {
                this.itemsMovedInbox++;
            }
            else
            {
                this.itemsMovedSentItems++;
            }
            this.totalItemsMoved++;
            return(true);
        }
        // Token: 0x060006B3 RID: 1715 RVA: 0x00033498 File Offset: 0x00031698
        private void ProcessFolderContents(Folder folder, DefaultFolderType folderTypeToCollect, ItemQueryType itemQueryType)
        {
            int num = base.FolderItemTypeCount(folder, itemQueryType);

            if (num <= 0)
            {
                MigrateToArchiveEnforcer.Tracer.TraceDebug <MigrateToArchiveEnforcer, string, ItemQueryType>((long)this.GetHashCode(), "{0}:{1} Folder is Empty of type {2}", this, folder.Id.ObjectId.ToHexEntryId(), itemQueryType);
                return;
            }
            using (QueryResult queryResult = folder.ItemQuery(itemQueryType, null, null, MigrateToArchiveEnforcer.PropertyColumns.PropertyDefinitions))
            {
                queryResult.SeekToOffset(SeekReference.OriginBeginning, 0);
                bool flag = false;
                while (!flag)
                {
                    object[][] rows = queryResult.GetRows(100);
                    if (rows.Length <= 0)
                    {
                        break;
                    }
                    foreach (object[] rawProperties in rows)
                    {
                        PropertyArrayProxy itemProperties = new PropertyArrayProxy(MigrateToArchiveEnforcer.PropertyColumns, rawProperties);
                        this.EnlistItem(itemProperties, folderTypeToCollect);
                        if (this.MaxItemsCollectedForThisCycle(folderTypeToCollect))
                        {
                            flag = true;
                            break;
                        }
                    }
                    base.SysCleanupSubAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxDataForTags.MailboxSession.MailboxOwner);
                }
            }
        }
        private void ChangeDestinationFolder(DefaultFolderType folderType, StoreDriverDeliveryEventArgs args)
        {
            StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args;
            string         text           = args.MailItem.FromAddress.ToString();
            MailboxSession mailboxSession = storeDriverDeliveryEventArgsImpl.MailboxSession;
            string         text2          = storeDriverDeliveryEventArgsImpl.MailRecipient.MsgId.ToString();
            bool           flag           = this.IsSourceEhaMigration(storeDriverDeliveryEventArgsImpl.MailItem, text2);

            UnJournalAgent.Tracer.TraceDebug(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, isSourceEha {2}, folderType {3} ", new object[]
            {
                text2,
                text,
                flag.ToString(),
                folderType.ToString()
            });
            if (DefaultFolderType.LegacyArchiveJournals == folderType || !flag)
            {
                UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, Source is not EHA or this is directed to legacyarchivejournals folder in journalndr mailbox", text2, text);
                StoreId storeId = mailboxSession.GetDefaultFolderId(folderType);
                if (storeId == null)
                {
                    storeId = mailboxSession.CreateDefaultFolder(folderType);
                }
                if (storeId != null)
                {
                    storeDriverDeliveryEventArgsImpl.DeliverToFolder = storeId;
                    return;
                }
            }
            else
            {
                UnJournalAgent.Tracer.TraceDebug <string, string>(0L, "ChangeDestinationFolder: MessageId {0}, Sender {1}, This is a migration message from EHA, put it in the hidden folder", text2, text);
                storeDriverDeliveryEventArgsImpl.DeliverToFolder = this.GetCreateFolderIdUnderGivenParentFolder("MigrationFolder", folderType.ToString(), mailboxSession);
            }
        }
        // Token: 0x06000621 RID: 1569 RVA: 0x0002F154 File Offset: 0x0002D354
        private bool IsFolderSkippable(PropertyArrayProxy folderProperties)
        {
            VersionedId versionedId = folderProperties[FolderSchema.Id] as VersionedId;

            if (versionedId == null)
            {
                SupplementExpirationEnforcer.Tracer.TraceError <SupplementExpirationEnforcer>((long)this.GetHashCode(), "{0}: We could not get id of this folder. Skipping it.", this);
                return(true);
            }
            object obj = folderProperties[FolderSchema.MapiFolderType];

            if (obj is int && ((FolderType)obj & FolderType.Search) == FolderType.Search)
            {
                SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, VersionedId>((long)this.GetHashCode(), "{0}: The folder {1} is a search folder. Skipping it for expiration.", this, versionedId);
                return(true);
            }
            if (!(folderProperties[FolderSchema.FolderFlags] is int))
            {
                SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, VersionedId>((long)this.GetHashCode(), "{0}: The FolderFlags prop doesn't not exist on folder {1}. Skipping it for expiration.", this, versionedId);
                return(true);
            }
            StoreFolderFlags storeFolderFlags = (StoreFolderFlags)folderProperties[FolderSchema.FolderFlags];

            if ((storeFolderFlags & StoreFolderFlags.FolderIPM) == StoreFolderFlags.FolderIPM)
            {
                SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, VersionedId>((long)this.GetHashCode(), "{0}: The folder {1} is under IPM subtree. Skipping it for expiration.", this, versionedId);
                return(true);
            }
            DefaultFolderType defaultFolderType = base.MailboxDataForTags.MailboxSession.IsDefaultFolderType(versionedId);

            if (defaultFolderType == DefaultFolderType.System || defaultFolderType == DefaultFolderType.AdminAuditLogs || defaultFolderType == DefaultFolderType.Audits || defaultFolderType == DefaultFolderType.RecoverableItemsRoot || defaultFolderType == DefaultFolderType.RecoverableItemsVersions || defaultFolderType == DefaultFolderType.RecoverableItemsDeletions || defaultFolderType == DefaultFolderType.RecoverableItemsPurges || defaultFolderType == DefaultFolderType.RecoverableItemsDiscoveryHolds || defaultFolderType == DefaultFolderType.RecoverableItemsMigratedMessages || defaultFolderType == DefaultFolderType.CalendarLogging)
            {
                SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, DefaultFolderType>((long)this.GetHashCode(), "{0}: This folder type is {1}. Skipping it for expiration.", this, defaultFolderType);
                return(true);
            }
            if (base.MailboxDataForTags.ElcUserInformation.ProcessEhaMigratedMessages && !base.MailboxDataForTags.MailboxSession.MailboxOwner.MailboxInfo.IsArchive)
            {
                using (Folder folder = Folder.Bind(base.MailboxDataForTags.MailboxSession, versionedId, new PropertyDefinition[]
                {
                    FolderSchema.DisplayName
                }))
                {
                    if (string.Compare(folder.DisplayName, ElcGlobals.MigrationFolderName, true) == 0 || string.Compare(folder.DisplayName, DefaultFolderType.Inbox.ToString(), true) == 0 || string.Compare(folder.DisplayName, DefaultFolderType.SentItems.ToString(), true) == 0)
                    {
                        SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, string>((long)this.GetHashCode(), "{0}: This is a migration folder in primary mailbox {1}. SupplementEnforcer skips it as it has a separate enforcer.", this, folder.DisplayName);
                        return(true);
                    }
                }
            }
            int num  = (int)folderProperties[FolderSchema.ItemCount];
            int num2 = (int)folderProperties[FolderSchema.AssociatedItemCount];

            if (num == 0 && num2 == 0)
            {
                SupplementExpirationEnforcer.Tracer.TraceDebug <SupplementExpirationEnforcer, VersionedId>((long)this.GetHashCode(), "{0}: The Folder {1} is empty. Skipping it for expiration", this, versionedId);
                return(true);
            }
            return(false);
        }
 // Token: 0x060005DA RID: 1498 RVA: 0x0002C6E0 File Offset: 0x0002A8E0
 private void ProcessFolderType(DefaultFolderType defaultFolderType, DumpsterExpirationEnforcer.AgeLimitAndAction ageLimitAndAction)
 {
     using (Folder folder = Folder.Bind(base.MailboxDataForTags.MailboxSession, defaultFolderType))
     {
         this.ProcessFolderContents(folder, defaultFolderType, ItemQueryType.None, ageLimitAndAction);
         this.ProcessFolderContents(folder, defaultFolderType, ItemQueryType.Associated, ageLimitAndAction);
     }
 }
 // Token: 0x060006B4 RID: 1716 RVA: 0x00033588 File Offset: 0x00031788
 private bool MaxItemsCollectedForThisCycle(DefaultFolderType folderType)
 {
     if (this.totalItemsMoved >= this.MaxItemsToMigrateInOneCycle)
     {
         MigrateToArchiveEnforcer.Tracer.TraceDebug <MigrateToArchiveEnforcer, string, int>((long)this.GetHashCode(), "{0}:{1} Migration Folder type {2} , Max items collected so far. Rest will be colleced in next ELC cycle", this, folderType.ToString(), this.totalItemsMoved);
         return(true);
     }
     return(false);
 }
        // Token: 0x060006B2 RID: 1714 RVA: 0x00033444 File Offset: 0x00031644
        private void ProcessFolderType(DefaultFolderType defaultFolderType)
        {
            StoreId folderId = this.folderIdsToProcess[defaultFolderType];

            using (Folder folder = Folder.Bind(base.MailboxDataForTags.MailboxSession, folderId))
            {
                this.ProcessFolderContents(folder, defaultFolderType, ItemQueryType.None);
            }
        }
Exemple #10
0
        private StoreObjectId GetFolderId(DefaultFolderContext context, DefaultFolderType folderType)
        {
            StoreObjectId storeObjectId = context[folderType];

            if (storeObjectId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ExDefaultFolderNotFound(folderType));
            }
            return(storeObjectId);
        }
Exemple #11
0
 internal static ElcFolderType?GetElcFolderType(DefaultFolderType defaultType)
 {
     for (int i = 0; i < ElcMailboxHelper.DefaultFolderTypeList.Length; i++)
     {
         if (ElcMailboxHelper.DefaultFolderTypeList[i] == defaultType)
         {
             return(new ElcFolderType?(ElcMailboxHelper.ElcFolderTypeList[i]));
         }
     }
     return(null);
 }
        // Token: 0x06000380 RID: 896 RVA: 0x000187A0 File Offset: 0x000169A0
        internal static bool IsRetainableItem(UserRetentionPolicyCache mailboxState, MailboxSession mailboxSession, StoreObjectId parentId, StoreObject item)
        {
            DefaultFolderType parentDefaultFolderType = TagAssistantHelper.GetParentDefaultFolderType(mailboxState, mailboxSession, parentId);

            if (UserRetentionPolicyCache.IsFolderTypeToSkip(parentDefaultFolderType))
            {
                TagAssistantHelper.Tracer.TraceDebug <DefaultFolderType>(0L, "Current item is in folder {0} (or a sub-folder) that should not be processed.", parentDefaultFolderType);
                return(false);
            }
            return(TagAssistantHelper.IsRetainableItem(item.ClassName));
        }
Exemple #13
0
 // Token: 0x060004DE RID: 1246 RVA: 0x00024F8C File Offset: 0x0002318C
 internal static bool IsFolderTypeToSkip(DefaultFolderType folderType)
 {
     foreach (DefaultFolderType defaultFolderType in UserRetentionPolicyCache.typeFoldersToSkip)
     {
         if (folderType == defaultFolderType)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #14
0
 // Token: 0x060006A6 RID: 1702 RVA: 0x00032EF8 File Offset: 0x000310F8
 private void IncrementFolderCollectCount(DefaultFolderType folderType, int itemsCollected)
 {
     if (folderType == DefaultFolderType.Inbox)
     {
         this.itemsDeletedFromInbox += itemsCollected;
         return;
     }
     if (folderType != DefaultFolderType.SentItems)
     {
         return;
     }
     this.itemsDeletedFromSent += itemsCollected;
 }