// Token: 0x060002D5 RID: 725 RVA: 0x000115C4 File Offset: 0x0000F7C4 private void BuildListOfProvisionedFolders() { VersionedId rootFolderId = null; string text = null; using (Folder folder = Folder.Bind(this.MailboxSession, DefaultFolderType.Root, FolderProcessor.DataColumns)) { rootFolderId = folder.Id; try { if (ElcMailboxHelper.Exists(folder[FolderSchema.ELCPolicyIds])) { text = (string)folder[FolderSchema.ELCPolicyIds]; List <object> list = new List <object>(folder.GetProperties(FolderProcessor.DataColumns)); list.Add(list[3]); this.entireFolderList.Add(list.ToArray()); FolderProcessor.Tracer.TraceDebug <FolderProcessor, string>((long)this.GetHashCode(), "{0}: Root Policy '{1}' is set for this mailbox.", this, text); } } catch (PropertyErrorException ex) { if (ex.PropertyErrors[0].PropertyErrorCode != PropertyErrorCode.NotFound) { throw; } FolderProcessor.Tracer.TraceDebug <FolderProcessor>((long)this.GetHashCode(), "{0}: Root Policy does not exist for this mailbox.", this); } using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, FolderProcessor.DataColumns)) { for (;;) { object[][] rows = queryResult.GetRows(100); if (rows.Length <= 0) { break; } for (int i = 0; i < rows.Length; i++) { this.entireFolderList.Add(rows[i]); } } } } ElcMailboxHelper.PopulateFolderPathProperty(this.entireFolderList, new FolderPathIndices(3, 6, 0, 1, 7)); for (int j = 0; j < this.entireFolderList.Count; j++) { ProvisionedFolder provisionedFolder = this.GetProvisionedFolder(j, rootFolderId, text); if (provisionedFolder != null) { this.ProvisionedFolderList.Add(provisionedFolder); } } FolderProcessor.Tracer.TraceDebug <FolderProcessor, int>((long)this.GetHashCode(), "{0}: Number of folders found with policies for this mailbox is: {1}.", this, this.ProvisionedFolderList.Count); }
// Token: 0x0600063F RID: 1599 RVA: 0x0002FC3C File Offset: 0x0002DE3C bool IAuditRecordStrategy <ItemData> .RecordFilter(IReadOnlyPropertyBag propertyBag, out bool stopNow) { stopNow = false; VersionedId versionedId = propertyBag[ItemSchema.Id] as VersionedId; if (versionedId == null) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.ErrorTrace)) { AuditExpirationEnforcer.Tracer.TraceError <AuditExpirationEnforcer>((long)this.GetHashCode(), "{0}: We could not get id of this item. Skipping it.", this); } return(false); } if (ElcGlobals.ExpireDumpsterRightNow) { return(true); } object obj = propertyBag[StoreObjectSchema.CreationTime]; if (!ElcMailboxHelper.Exists(obj)) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace)) { AuditExpirationEnforcer.Tracer.TraceDebug <AuditExpirationEnforcer>((long)this.GetHashCode(), "{0}: CreationTime date is missing. Skipping the item.", this); } return(false); } DateTime dateTime = (DateTime)((ExDateTime)obj).ToUtc(); if (dateTime > this.expirationTime) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace)) { AuditExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Item {1} newer than minAgeLimitForFolder. Item:{2}, Limit:{3}.", new object[] { this, versionedId, dateTime, this.expirationTime }); } stopNow = true; return(false); } if (this.oldestExpiringLog.CompareTo(DateTime.MinValue) == 0) { this.oldestExpiringLog = dateTime; } else if (dateTime.CompareTo(this.oldestExpiringLog) < 0) { this.oldestExpiringLog = dateTime; } return(true); }
// Token: 0x06000296 RID: 662 RVA: 0x0000F884 File Offset: 0x0000DA84 private DateTime GetStartDateFromCreationDate(object[] itemProperties) { DateTime result = DateTime.MinValue; if (ElcMailboxHelper.Exists(itemProperties[this.propertyIndexHolder.ReceivedTimeIndex])) { result = (DateTime)((ExDateTime)itemProperties[this.propertyIndexHolder.ReceivedTimeIndex]); } else if (ElcMailboxHelper.Exists(itemProperties[this.propertyIndexHolder.CreationTimeIndex])) { result = (DateTime)((ExDateTime)itemProperties[this.propertyIndexHolder.CreationTimeIndex]); } return(result); }
// Token: 0x06000291 RID: 657 RVA: 0x0000F150 File Offset: 0x0000D350 private DateTime?GetCalStartDateFromView(object[] itemProperties) { if (this.folderType == DefaultFolderType.Calendar) { if (ElcMailboxHelper.Exists(itemProperties[this.propertyIndexHolder.CalendarTypeIndex]) && ElcMailboxHelper.Exists(itemProperties[this.propertyIndexHolder.EndDateIndex]) && (CalendarItemType)itemProperties[this.propertyIndexHolder.CalendarTypeIndex] == CalendarItemType.Single) { this.tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Using end date property in view to calculate start date of item in Folder: {1}.", TraceContext.Get(), this.folderDisplayName); return(new DateTime?((DateTime)((ExDateTime)itemProperties[this.propertyIndexHolder.EndDateIndex]))); } if (!ElcMailboxHelper.Exists(itemProperties[this.propertyIndexHolder.CalendarTypeIndex])) { this.tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Calendar item in Folder: {1} is corrupt.", TraceContext.Get(), this.folderDisplayName); return(new DateTime?(ItemStartDateCalculator.startDateForCorruptItems)); } } return(null); }
// Token: 0x060002CD RID: 717 RVA: 0x00010E44 File Offset: 0x0000F044 internal string GetFolderPathFromId(StoreObjectId folderId) { string result = null; foreach (object[] array in this.entireFolderList) { if (ElcMailboxHelper.Exists(array[0])) { StoreObjectId objectId = ((VersionedId)array[0]).ObjectId; if (objectId.Equals(folderId)) { result = (ElcMailboxHelper.Exists(array[7]) ? ((string)array[7]) : null); break; } } } return(result); }
// Token: 0x06000673 RID: 1651 RVA: 0x0003133C File Offset: 0x0002F53C private void ProcessFolderContents(Folder folder, ItemQueryType itemQueryType) { int num = base.FolderItemTypeCount(folder, itemQueryType); if (num <= 0) { CalendarLogExpirationEnforcer.Tracer.TraceDebug <CalendarLogExpirationEnforcer, 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, new SortBy[] { new SortBy(CalendarLogExpirationEnforcer.agePropertyDefinition, SortOrder.Ascending) }, CalendarLogExpirationEnforcer.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 propertyArrayProxy = new PropertyArrayProxy(CalendarLogExpirationEnforcer.PropertyColumns, rawProperties); if (!ElcMailboxHelper.Exists(propertyArrayProxy[CalendarLogExpirationEnforcer.agePropertyDefinition])) { CalendarLogExpirationEnforcer.Tracer.TraceDebug <CalendarLogExpirationEnforcer>((long)this.GetHashCode(), "{0}: Last Modified date is missing. Skipping items from here on.", this); flag = true; break; } if (!this.EnlistItem(propertyArrayProxy)) { flag = true; break; } } base.SysCleanupSubAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxDataForTags.MailboxSession.MailboxOwner); } } }
// Token: 0x060002D6 RID: 726 RVA: 0x00011780 File Offset: 0x0000F980 private ProvisionedFolder GetProvisionedFolder(int currFolderIdx, VersionedId rootFolderId, string rootFolderPolicyIds) { bool flag = false; if (!ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][2])) { flag = true; FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' does not have any policy associated. Checking parent and root.", this, this.entireFolderList[currFolderIdx][3]); object obj = this.entireFolderList[currFolderIdx][1]; int num = currFolderIdx; while (ElcMailboxHelper.Exists(obj) && !((StoreObjectId)obj).Equals(rootFolderId.ObjectId)) { int num2 = -1; int num3 = (num == 0) ? (this.entireFolderList.Count - 1) : (num - 1); while (num3 != num) { VersionedId versionedId = (VersionedId)this.entireFolderList[num3][0]; if (versionedId.ObjectId.Equals((StoreObjectId)obj)) { num2 = num3; break; } if (num3 == 0) { num3 = this.entireFolderList.Count - 1; } else { num3--; } } if (num2 == -1) { throw new SkipException(Strings.descMissingParentFolder(this.entireFolderList[num][3], obj)); } if (ElcMailboxHelper.Exists(this.entireFolderList[num2][2])) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, object, object>((long)this.GetHashCode(), "{0}: Parent folder '{1}' of folder '{2}' has policy. Assigning to child.", this, this.entireFolderList[num2][3], this.entireFolderList[currFolderIdx][3]); this.entireFolderList[currFolderIdx][2] = this.entireFolderList[num2][2]; break; } obj = this.entireFolderList[num2][1]; num = num2; } if (!ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][2]) && !string.IsNullOrEmpty(rootFolderPolicyIds)) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' takes on root policy.", this, this.entireFolderList[currFolderIdx][3]); this.entireFolderList[currFolderIdx][2] = rootFolderPolicyIds; } } if (!ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][2])) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' being discarded because it does not have an associated folder object.", this, this.entireFolderList[currFolderIdx][3]); return(null); } string displayName = (string)this.entireFolderList[currFolderIdx][3]; AdFolderData folderDataFromList = this.GetFolderDataFromList((string)this.entireFolderList[currFolderIdx][2]); if (folderDataFromList.Folder.BaseFolderOnly && flag) { if (string.IsNullOrEmpty(rootFolderPolicyIds) || !((string)this.entireFolderList[currFolderIdx][2] != rootFolderPolicyIds)) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' being discarded because it does not inherit policy and not root policy is defined..", this, this.entireFolderList[currFolderIdx][3]); return(null); } FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' takes on root policy.", this, this.entireFolderList[currFolderIdx][3]); this.entireFolderList[currFolderIdx][2] = rootFolderPolicyIds; folderDataFromList = this.GetFolderDataFromList((string)this.entireFolderList[currFolderIdx][2]); } VersionedId versionedId2 = (VersionedId)this.entireFolderList[currFolderIdx][0]; bool isProvisionedFolder = ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][4]) && ((int)this.entireFolderList[currFolderIdx][4] & 1) != 0; string containerClass = null; if (ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][5])) { containerClass = (string)this.entireFolderList[currFolderIdx][5]; } string fullFolderPath = string.Empty; if (ElcMailboxHelper.Exists(this.entireFolderList[currFolderIdx][7])) { fullFolderPath = HttpUtility.UrlDecode((string)this.entireFolderList[currFolderIdx][7]); } if (folderDataFromList == null || folderDataFromList.FolderSettings == null) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, object>((long)this.GetHashCode(), "{0}: Folder '{1}' has an associated ElcFolder object, but no policy applies to it.", this, this.entireFolderList[currFolderIdx][3]); } return(new ProvisionedFolder(versionedId2.ObjectId, displayName, fullFolderPath, containerClass, isProvisionedFolder, folderDataFromList.FolderSettings, new Guid((string)this.entireFolderList[currFolderIdx][2]), flag)); }
// Token: 0x060002D3 RID: 723 RVA: 0x000111E0 File Offset: 0x0000F3E0 private void GetSubfoldersToCreate(string targetRootPath, string sourcePath, StoreObjectId targetRootId, out string[] subfoldersToCreate, out StoreObjectId startFolderId, out string startFolderPath) { subfoldersToCreate = null; startFolderPath = null; startFolderId = null; string empty = string.Empty; int num = 0; string text = string.Concat(new object[] { targetRootPath.TrimEnd(new char[] { '/' }), '/', sourcePath.TrimStart(new char[] { '/' }), '/' }); foreach (object[] array in this.entireFolderList) { string text2 = ElcMailboxHelper.Exists(array[7]) ? ((string)array[7]) : null; if (string.IsNullOrEmpty(text2)) { FolderProcessor.Tracer.TraceError <FolderProcessor, string>((long)this.GetHashCode(), "{0}: ExpirationEnforcer is creating folder hierarchy under target folder. Skipping current folder during second pass through folder list, since it is missing UrlName property. Source folder: {1}.", this, sourcePath); } else { text2 += '/'; if (text.StartsWith(text2, StringComparison.OrdinalIgnoreCase) && text2.Length > num) { if (ElcMailboxHelper.Exists(array[0])) { num = text2.Length; startFolderId = ((VersionedId)array[0]).ObjectId; startFolderPath = text2; } else { FolderProcessor.Tracer.TraceDebug <FolderProcessor, string>((long)this.GetHashCode(), "{0}: ExpirationEnforcer is creating folder hierarchy under target. Skipping current folder during second pass through folder list, since it is missing versionedId. Source folder: {1}.", this, sourcePath); } } } } if (num == text.Length) { return; } if (startFolderId == null) { FolderProcessor.Tracer.TraceDebug <FolderProcessor, string>((long)this.GetHashCode(), "{0}: ExpirationEnforcer is creating folder hierarchy under target. No matching folder found under the target root, so the hierarchy will be created, starting from the target root folder.Source folder: {1}.", this, sourcePath); startFolderId = targetRootId; num = targetRootPath.Length; } string text3 = text.Substring(num); text3 = HttpUtility.UrlDecode(text3); subfoldersToCreate = text3.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); }
// Token: 0x0600037C RID: 892 RVA: 0x000180B4 File Offset: 0x000162B4 internal override void Invoke(ProvisionedFolder provisionedFolder, List <object[]> items, PropertyIndexHolder propertyIndexHolder) { FolderExpirationExecutor folderExpirationExecutor = new FolderExpirationExecutor(provisionedFolder, base.MailboxData, base.Assistant); ExpirationEnforcer.Tracer.TraceDebug <object, string, int>((long)this.GetHashCode(), "{0}: Number of items found in folder '{1}' is {2}.", TraceContext.Get(), provisionedFolder.DisplayName, items.Count); DefaultFolderType folderType = DefaultFolderType.None; if (provisionedFolder.FolderId.Equals(base.MailboxData.MailboxSession.GetDefaultFolderId(DefaultFolderType.DeletedItems))) { folderType = DefaultFolderType.DeletedItems; } else if (provisionedFolder.ContainerClass != null && ObjectClass.IsCalendarFolder(provisionedFolder.ContainerClass)) { folderType = DefaultFolderType.Calendar; } else if (provisionedFolder.ContainerClass != null && ObjectClass.IsTaskFolder(provisionedFolder.ContainerClass)) { folderType = DefaultFolderType.Tasks; } ItemStartDateCalculator itemStartDateCalculator = new ItemStartDateCalculator(propertyIndexHolder, provisionedFolder.Folder.DisplayName, folderType, base.MailboxData.MailboxSession, ExpirationEnforcer.Tracer); FolderAuditLogData folderAuditLogData = null; if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled) { folderAuditLogData = new FolderAuditLogData(provisionedFolder, base.MailboxData, ELCAction.Retention.ToString()); } foreach (object[] array in items) { VersionedId versionedId = array[propertyIndexHolder.IdIndex] as VersionedId; string text = array[propertyIndexHolder.ItemClassIndex] as string; if (versionedId == null) { ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Current item in folder {1} is null. Skipping it.", TraceContext.Get(), provisionedFolder.DisplayName); } else { provisionedFolder.CurrentItems = new VersionedId[] { versionedId }; text = ((text == null) ? string.Empty : text.ToLower()); ContentSetting contentSetting = null; contentSetting = ElcPolicySettings.GetApplyingPolicy(provisionedFolder.ElcPolicies, text, provisionedFolder.ItemClassToPolicyMapping); if (contentSetting == null) { ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Policy for item class {1} in folder {2} is null. Skipping item.", TraceContext.Get(), text, provisionedFolder.DisplayName); } else if (!base.MailboxData.FolderProcessor.IsPolicyValid(provisionedFolder, contentSetting, text, base.MailboxData)) { ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Removing policy {1} from the list in folder {2} because it is invalid.", TraceContext.Get(), contentSetting.Name, provisionedFolder.DisplayName); provisionedFolder.RemovePolicy(contentSetting); } else { double totalDays = contentSetting.AgeLimitForRetention.Value.TotalDays; int num; if (contentSetting.TriggerForRetention == RetentionDateType.WhenMoved) { ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Applying policy. Policy '{1}' expires based on move date.", TraceContext.Get(), contentSetting.Name); CompositeProperty compositeProperty = null; if (ElcMailboxHelper.Exists(array[propertyIndexHolder.MoveDateIndex])) { try { compositeProperty = CompositeProperty.Parse((byte[])array[propertyIndexHolder.MoveDateIndex]); } catch (ArgumentException ex) { ExpirationEnforcer.Tracer.TraceError((long)this.GetHashCode(), "{0}: Could not parse move date property of item. Folder: {1} ItemClass: {2} Exception: {3}.", new object[] { TraceContext.Get(), provisionedFolder.DisplayName, text, ex }); base.MailboxData.ThrowIfErrorsOverLimit(); } } if (compositeProperty == null) { string arg = "Stamped Move date is null."; ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId, string>((long)this.GetHashCode(), "{0}: Move date needs to be stamped on item {1}. {2}", TraceContext.Get(), versionedId, arg); folderExpirationExecutor.AddToMoveDateStampingList(new ItemData(versionedId, (int)array[propertyIndexHolder.SizeIndex])); continue; } ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Calculating age of item {1} based on move date", TraceContext.Get(), versionedId); num = (int)base.MailboxData.Now.Subtract(compositeProperty.Date.Value).TotalDays; } else { DateTime startDate = itemStartDateCalculator.GetStartDate(versionedId, text, array); if (startDate == DateTime.MinValue) { num = 0; } else { num = (int)base.MailboxData.UtcNow.Subtract(startDate).TotalDays; } } try { if ((double)num >= totalDays) { if (contentSetting.RetentionAction == RetentionActionType.MarkAsPastRetentionLimit && array[propertyIndexHolder.ExpiryTimeIndex] != null && !(array[propertyIndexHolder.ExpiryTimeIndex] is PropertyError)) { ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Item {1} is already tagged with expiry time, hence will not tag again.", TraceContext.Get(), versionedId); } else { ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Adding item {1} to list to be expired.", TraceContext.Get(), versionedId); ItemAuditLogData itemAuditLogData = null; if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled) { folderAuditLogData.ExpirationAction = contentSetting.RetentionAction.ToString(); itemAuditLogData = new ItemAuditLogData(array, propertyIndexHolder, folderAuditLogData); } ItemData itemData = new ItemData(versionedId, (array[propertyIndexHolder.ReceivedTimeIndex] is ExDateTime) ? ((DateTime)((ExDateTime)array[propertyIndexHolder.ReceivedTimeIndex])) : DateTime.MinValue, itemAuditLogData, (int)array[propertyIndexHolder.SizeIndex]); folderExpirationExecutor.AddToReportAndDoomedList(array, propertyIndexHolder, contentSetting, itemData, text, this.allPolicyTags); } } } catch (InvalidExpiryDestinationException ex2) { ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Removing policy '{1}', that applies to folder '{2}' from list of policies to process. Exception: {3}", new object[] { TraceContext.Get(), contentSetting.Name, contentSetting.ManagedFolderName, ex2 }); provisionedFolder.RemovePolicy(contentSetting); } catch (SkipFolderException ex3) { ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Policy '{1}', that applies to folder '{2}' will be skipped for the current folder. Exception: {3}", new object[] { TraceContext.Get(), contentSetting.Name, contentSetting.ManagedFolderName, ex3 }); return; } } } } ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Done identifying items for expiration. Proceed to expire.", new object[] { TraceContext.Get() }); ExpirationEnforcer.TracerPfd.TracePfd <int, object>((long)this.GetHashCode(), "PFD IWE {0} {1}: Done identifying items for expiration. Calling ExpirationExecutor to expire.", 26903, TraceContext.Get()); folderExpirationExecutor.ExecuteTheDoomed(); }