示例#1
0
        // Token: 0x06000494 RID: 1172 RVA: 0x00021100 File Offset: 0x0001F300
        private DateTime UpdateStartDateEtc(VersionedId itemId, string itemClass, object[] itemProperties)
        {
            CompositeProperty compositeProperty = new CompositeProperty();

            try
            {
                if (itemProperties[this.propertyIndexHolder.StartDateEtcIndex] is byte[])
                {
                    compositeProperty = CompositeProperty.Parse((byte[])itemProperties[this.propertyIndexHolder.StartDateEtcIndex], true);
                }
            }
            catch (ArgumentException arg)
            {
                PropertySynchronizerBase.Tracer.TraceError <ItemPropertySynchronizer, string, ArgumentException>((long)this.GetHashCode(), "{0}: Could not parse StartDateEtc property of item. ItemClass: {1} Exception: {2}.", this, itemClass, arg);
            }
            bool flag  = this.UpdateStartDate(compositeProperty, itemId, itemClass, itemProperties);
            bool flag2 = this.UpdateDefaultRetentionPeriod(compositeProperty, itemClass);

            if (flag || flag2)
            {
                base.PropertiesToBeUpdated.Add(ItemSchema.StartDateEtc, compositeProperty.GetBytes(true));
            }
            return(compositeProperty.Date.Value);
        }
示例#2
0
        private string GetMRMProps(Item item)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;

            byte[] propertyBytes = null;
            string str           = string.Empty;

            try
            {
                Guid guid = new Guid((byte[])item[StoreObjectSchema.PolicyTag]);
                stringBuilder.AppendLine("RetentionTagGuid: " + guid);
            }
            catch (PropertyErrorException)
            {
                stringBuilder.AppendLine("RetentionTagGuid: Not Found");
            }
            try
            {
                propertyBytes = (byte[])item[ItemSchema.StartDateEtc];
                flag          = true;
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                if (flag)
                {
                    DateTime value = CompositeProperty.Parse(propertyBytes, true).Date.Value;
                    stringBuilder.AppendLine("StartDate: " + value);
                }
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                DateTime universalTime = ((ExDateTime)item[ItemSchema.RetentionDate]).UniversalTime;
                stringBuilder.AppendLine("RetentionDate: " + universalTime);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                int?num = new int?((int)item[StoreObjectSchema.RetentionPeriod]);
                stringBuilder.AppendLine("RetentionPeriod: " + num);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                Guid guid2 = new Guid((byte[])item[StoreObjectSchema.ArchiveTag]);
                stringBuilder.AppendLine("ArchiveGuid: " + guid2);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                DateTime universalTime2 = ((ExDateTime)item[ItemSchema.ArchiveDate]).UniversalTime;
                stringBuilder.AppendLine("ArchiveDate: " + universalTime2);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                int?num2 = new int?((int)item[StoreObjectSchema.ArchivePeriod]);
                stringBuilder.AppendLine("ArchivePeriod: " + num2);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                DateTime universalTime3 = ((ExDateTime)item[ItemSchema.ReceivedTime]).UniversalTime;
                stringBuilder.AppendLine("ReceivedDate: " + universalTime3);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                DateTime universalTime4 = ((ExDateTime)item[StoreObjectSchema.LastModifiedTime]).UniversalTime;
                stringBuilder.AppendLine("LastModifiedTime: " + universalTime4);
            }
            catch (PropertyErrorException)
            {
            }
            try
            {
                str = item[StoreObjectSchema.ParentItemId].ToString();
                stringBuilder.AppendLine("FolderId: " + str);
            }
            catch (PropertyErrorException)
            {
            }
            return(stringBuilder.ToString());
        }
        // 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();
        }