Example #1
0
        private static SearchFolderCriteria CreateRemindersQueryForO12(DefaultFolderContext context, IEnumerable <QueryFilter> currentExclusionCriteria)
        {
            QueryFilter searchQuery = new AndFilter(new QueryFilter[]
            {
                SearchFolderValidation.GetSearchExclusionFoldersFilter(context, currentExclusionCriteria, SearchFolderValidation.ExcludeFromRemindersSearchFolder),
                new AndFilter(new QueryFilter[]
                {
                    new NotFilter(new AndFilter(new QueryFilter[]
                    {
                        new ExistsFilter(InternalSchema.ItemClass),
                        new TextFilter(InternalSchema.ItemClass, "IPM.Schedule", MatchOptions.Prefix, MatchFlags.Default)
                    })),
                    new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.HasBeenSubmitted, false),
                    RemindersSearchFolderValidation.CreateRemindersQueryForO11(context).SearchQuery
                })
            });

            return(new SearchFolderCriteria(searchQuery, new StoreId[]
            {
                context.Session.GetDefaultFolderId(DefaultFolderType.Root)
            })
            {
                DeepTraversal = true
            });
        }
Example #2
0
 private static bool IsReminderSearchFolderForO11(DefaultFolderContext context, SearchFolderCriteria currentCriteria)
 {
     ExTraceGlobals.DefaultFoldersTracer.TraceDebug <SearchFolderCriteria>(-1L, "RemindersSearchFolderValidation::IsReminderSearchFolderForO11. We are checking currentCriteria on the folder we found. currentCriteria = {0}.", currentCriteria);
     return(SearchFolderValidation.MatchSearchFolderCriteria(currentCriteria, RemindersSearchFolderValidation.CreateRemindersQueryForO11(context)));
 }
Example #3
0
 internal static SearchFolderCriteria CreateRemindersQueryForO11(DefaultFolderContext context)
 {
     return(RemindersSearchFolderValidation.CreateRemindersQueryForO11(context));
 }
Example #4
0
 private static void UnsetStaleReminders(DefaultFolderContext context, SearchFolder reminders)
 {
     ExTraceGlobals.DefaultFoldersTracer.TraceDebug(-1L, "RemindersSearchFolderValidation::UnsetStaleReminders.");
     using (QueryResult queryResult = reminders.ItemQuery(ItemQueryType.None, null, new SortBy[]
     {
         new SortBy(InternalSchema.ReminderIsSet, SortOrder.Descending),
         new SortBy(InternalSchema.ReminderNextTime, SortOrder.Descending)
     }, new PropertyDefinition[]
     {
         InternalSchema.ItemId,
         InternalSchema.ParentItemId,
         InternalSchema.ReminderIsSet
     }))
     {
         ExDateTime now         = ExDateTime.GetNow(context.Session.ExTimeZone);
         StoreId[]  folderScope = RemindersSearchFolderValidation.CreateRemindersQueryForO11(context).FolderScope;
         queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.LessThan, InternalSchema.ReminderNextTime, now));
         bool       flag = false;
         object[][] rows;
         while (!flag && (rows = queryResult.GetRows(2147483647)).Length > 0)
         {
             foreach (object[] array2 in rows)
             {
                 bool flag2;
                 if (Util.TryConvertTo <bool>(array2[2], out flag2) && !flag2)
                 {
                     flag = true;
                     break;
                 }
                 StoreObjectId storeObjectId = PropertyBag.CheckPropertyValue <StoreObjectId>(StoreObjectSchema.ParentItemId, array2[1]);
                 bool          flag3         = false;
                 foreach (StoreId id in folderScope)
                 {
                     if (storeObjectId.Equals(id))
                     {
                         flag3 = true;
                         break;
                     }
                 }
                 if (!flag3)
                 {
                     try
                     {
                         VersionedId storeId = PropertyBag.CheckPropertyValue <VersionedId>(ItemSchema.Id, array2[0]);
                         using (Item item = Item.Bind(context.Session, storeId))
                         {
                             if (item.Reminder != null)
                             {
                                 item.Reminder.IsSet = false;
                                 item.Save(SaveMode.NoConflictResolution);
                             }
                         }
                     }
                     catch (StoragePermanentException arg)
                     {
                         ExTraceGlobals.DefaultFoldersTracer.TraceDebug <object, StoragePermanentException>(-1L, "RemindersSearchFolderValidation::UnsetStaleReminders. Unable to unset a stale reminder of the item {0}: {1}", array2[0], arg);
                     }
                     catch (StorageTransientException arg2)
                     {
                         ExTraceGlobals.DefaultFoldersTracer.TraceDebug <object, StorageTransientException>(-1L, "RemindersSearchFolderValidation::UnsetStaleReminders. Unable to unset a stale reminder of the item {0}: {1}", array2[0], arg2);
                     }
                 }
             }
         }
     }
 }