internal static void AddMetadata(ICoreItem item, COWTriggerAction action, FolderChangeOperationFlags?folderChangeOperationFlags)
        {
            Dictionary <PropertyDefinition, object> metadata = CalendarLoggingHelper.GetMetadata(item, action, folderChangeOperationFlags);

            foreach (PropertyDefinition propertyDefinition in metadata.Keys)
            {
                item.PropertyBag[propertyDefinition] = metadata[propertyDefinition];
            }
        }
        private static Dictionary <PropertyDefinition, object> GetMetadata(ICoreItem item, COWTriggerAction action, FolderChangeOperationFlags?folderChangeOperationFlags)
        {
            Dictionary <PropertyDefinition, object> dictionary = new Dictionary <PropertyDefinition, object>(6);

            item.PropertyBag.Load(CalendarLoggingHelper.RequiredOriginalProperties);
            switch (action)
            {
            case COWTriggerAction.MoveToDeletedItems:
            case COWTriggerAction.SoftDelete:
            case COWTriggerAction.HardDelete:
                if (folderChangeOperationFlags != null)
                {
                    dictionary.Add(InternalSchema.ClientIntent, CalendarLoggingHelper.GetClientIntentFromFolderChangeOperationFlags(folderChangeOperationFlags.Value, item.PropertyBag.GetValueOrDefault <string>(InternalSchema.CalendarLogTriggerAction, string.Empty), item.PropertyBag.GetValueOrDefault <ClientIntentFlags>(InternalSchema.ClientIntent, ClientIntentFlags.None)));
                }
                break;
            }
            dictionary.Add(InternalSchema.OriginalFolderId, item.PropertyBag.GetValueOrDefault <object>(InternalSchema.ParentEntryId, Array <byte> .Empty));
            dictionary.Add(InternalSchema.OriginalCreationTime, item.PropertyBag.GetValueOrDefault <object>(InternalSchema.CreationTime, ExDateTime.MinValue));
            dictionary.Add(InternalSchema.OriginalEntryId, item.PropertyBag.GetValueOrDefault <object>(InternalSchema.EntryId, Array <byte> .Empty));
            dictionary.Add(InternalSchema.ItemVersion, item.PropertyBag.GetValueOrDefault <int>(InternalSchema.ItemVersion, 0) + 1);
            dictionary.Add(InternalSchema.ChangeList, item.LocationIdentifierHelperInstance.ChangeBuffer);
            return(dictionary);
        }
 internal static bool ShouldLogInitialCheck(StoreObjectId itemId, COWTriggerAction operation)
 {
     Util.ThrowOnNullArgument(itemId, "itemId");
     return(CalendarLoggingHelper.ShouldLog(operation) && (itemId.ObjectType == StoreObjectType.Unknown || CalendarLoggingHelper.IsCalendarItem(itemId)));
 }
 internal static bool ShouldLog(ICoreItem item, COWTriggerAction action)
 {
     return(item != null && ((item.StoreObjectId != null || action == COWTriggerAction.Create) && (item.IsDirty || action != COWTriggerAction.Update) && CalendarLoggingHelper.ShouldLog(action)) && CalendarLoggingHelper.IsCalendarItem(item));
 }