Beispiel #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
            });
        }
Beispiel #2
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Entering FromFavoriteSendersFolderValidation.EnsureIsValid");
            if (!base.EnsureIsValid(context, folder))
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid:  folder failed base class validation.");
                return(false);
            }
            SearchFolder searchFolder = folder as SearchFolder;

            if (searchFolder == null)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.Validate:  not a SearchFolder instance.");
                return(false);
            }
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(searchFolder);
            SearchFolderCriteria searchCriteria       = FromFavoriteSendersFolderValidation.GetSearchCriteria(context);

            if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(searchFolderCriteria, searchCriteria) || searchFolderCriteria.DeepTraversal != searchCriteria.DeepTraversal)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceDebug((long)this.GetHashCode(), "Current criteria are NOT initialized or don't match desired criteria.  Updating.");
                searchFolder.ApplyContinuousSearch(searchCriteria);
            }
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid.  Validation is done.");
            return(true);
        }
Beispiel #3
0
        private bool ValidateUMFaxFilter(DefaultFolderContext context, OutlookSearchFolder folder)
        {
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(folder);

            if (searchFolderCriteria == null || !UMFaxValidation.GetUMFaxQueryFilter(context).Equals(searchFolderCriteria.SearchQuery))
            {
                folder.ApplyContinuousSearch(UMFaxValidation.CreateUMFaxSearchCriteria(context));
            }
            return(true);
        }
Beispiel #4
0
        private bool ValidateUMVoiceMailFilter(DefaultFolderContext context, OutlookSearchFolder folder)
        {
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(folder);

            if (searchFolderCriteria == null || !UMVoiceMailValidation.GetUMVoicemailQueryFilter(context).Equals(searchFolderCriteria.SearchQuery))
            {
                folder.ApplyContinuousSearch(UMVoiceMailValidation.CreateUMVoiceMailSearchCriteria(context));
                folder.MakeVisibleToOutlook(true);
            }
            return(true);
        }
Beispiel #5
0
        private static bool VerifyAndFixSearchFolder(DefaultFolderContext context, SearchFolder folder)
        {
            SearchFolderCriteria searchFolderCriteria  = SearchFolderValidation.TryGetSearchCriteria(folder);
            SearchFolderCriteria searchFolderCriteria2 = AllItemsFolderValidation.CreateSearchCriteria(context);

            if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(searchFolderCriteria, searchFolderCriteria2))
            {
                AllItemsFolderValidation.TryApplyContinuousSearch(folder, searchFolderCriteria2);
            }
            return(true);
        }
Beispiel #6
0
 private static QueryFilter GetQueryFilter(DefaultFolderContext context)
 {
     return(new AndFilter(new QueryFilter[]
     {
         SearchFolderValidation.GetSearchExclusionFoldersFilter(context, null, AllContactsFolderValidation.ExcludedFolders),
         new OrFilter(new QueryFilter[]
         {
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Contact"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.DistList")
         })
     }));
 }
Beispiel #7
0
 private static void TryApplyContinuousSearch(SearchFolder folder, SearchFolderCriteria criteria)
 {
     try
     {
         folder.ApplyContinuousSearch(criteria);
     }
     catch (QueryInProgressException)
     {
         SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(folder);
         if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(criteria, searchFolderCriteria))
         {
             throw;
         }
     }
 }
Beispiel #8
0
 internal static QueryFilter GetUMVoicemailQueryFilter(DefaultFolderContext context)
 {
     return(new AndFilter(new QueryFilter[]
     {
         SearchFolderValidation.GetSearchExclusionFoldersFilter(context, null, UMVoiceMailValidation.excludeFromUMSearchFolder),
         new OrFilter(new QueryFilter[]
         {
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.Microsoft.Voicemail.UM.CA"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.rpmsg.Microsoft.Voicemail.UM.CA"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.rpmsg.Microsoft.Voicemail.UM"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.Microsoft.Exchange.Voice.UM.CA"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.Microsoft.Voicemail.UM"),
             new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.Microsoft.Exchange.Voice.UM")
         })
     }));
 }
Beispiel #9
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            if (!base.EnsureIsValid(context, folder) || !(folder is SearchFolder))
            {
                return(false);
            }
            SearchFolder         searchFolder         = (SearchFolder)folder;
            SearchFolderCriteria searchFolderCriteria = CalendarVersionStoreValidation.CreateCalendarVersionSearchCriteria(context);
            SearchFolderCriteria searchCriteria       = searchFolder.GetSearchCriteria();

            if (!SearchFolderValidation.MatchSearchFolderCriteria(searchCriteria, searchFolderCriteria))
            {
                searchFolder.ApplyContinuousSearch(searchFolderCriteria);
            }
            return(true);
        }
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            if (!base.EnsureIsValid(context, folder))
            {
                return(false);
            }
            SearchFolder searchFolder = folder as SearchFolder;

            if (searchFolder == null)
            {
                return(false);
            }
            if (SearchFolderValidation.TryGetSearchCriteria(searchFolder) == null)
            {
                this.SetPropertiesInternal(context, folder);
            }
            return(true);
        }
Beispiel #11
0
        private static RemindersSearchFolderValidation.RemindersSearchFolderState GetRemindersSearchFolderState(DefaultFolderContext context, SearchFolder reminders)
        {
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(reminders);

            if (searchFolderCriteria == null)
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug(-1L, "RemindersSearchFolderValidation::GetRemindersSearchFolderState. currentCriteria is null.");
                return(new RemindersSearchFolderValidation.RemindersSearchFolderState(RemindersSearchFolderValidation.RemindersSearchFolderVersion.NotSet, false));
            }
            if (RemindersSearchFolderValidation.IsReminderSearchFolderForO11(context, searchFolderCriteria))
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug <SearchFolderCriteria>(-1L, "RemindersSearchFolderValidation::GetRemindersSearchFolderState. currentCriteria is O11. current = {0}.", searchFolderCriteria);
                return(new RemindersSearchFolderValidation.RemindersSearchFolderState(RemindersSearchFolderValidation.RemindersSearchFolderVersion.O11, false));
            }
            bool isUpToDate;

            if (RemindersSearchFolderValidation.IsReminderSearchFolderForO12(context, searchFolderCriteria, out isUpToDate))
            {
                ExTraceGlobals.DefaultFoldersTracer.TraceDebug <SearchFolderCriteria>(-1L, "DefaultFolderManager::GetRemindersSearchFolderState. currentCriteria is O12. current = {0}.", searchFolderCriteria);
                return(new RemindersSearchFolderValidation.RemindersSearchFolderState(RemindersSearchFolderValidation.RemindersSearchFolderVersion.O12, isUpToDate));
            }
            ExTraceGlobals.DefaultFoldersTracer.Information <string>(-1L, "Reminders search folder has an unknown criteria; probably from a newer client: {0}", searchFolderCriteria.SearchQuery.ToString());
            return(new RemindersSearchFolderValidation.RemindersSearchFolderState(RemindersSearchFolderValidation.RemindersSearchFolderVersion.Unknown, true));
        }
Beispiel #12
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)));
 }
Beispiel #13
0
        internal static SearchFolderCriteria GetToDoSearchCriteria(DefaultFolderContext context)
        {
            QueryFilter queryFilter = new OrFilter(new QueryFilter[]
            {
                new TextFilter(InternalSchema.ItemClass, "IPM.Task", MatchOptions.FullString, MatchFlags.IgnoreCase),
                new TextFilter(InternalSchema.ItemClass, "IPM.Task.", MatchOptions.Prefix, MatchFlags.IgnoreCase)
            });
            QueryFilter queryFilter2 = new NotFilter(new AndFilter(new QueryFilter[]
            {
                new AndFilter(new QueryFilter[]
                {
                    new ExistsFilter(InternalSchema.TaskType),
                    new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.TaskType, TaskDelegateState.Owned)
                }),
                new AndFilter(new QueryFilter[]
                {
                    new ExistsFilter(InternalSchema.TaskAccepted),
                    new ComparisonFilter(ComparisonOperator.NotEqual, InternalSchema.TaskAccepted, true)
                })
            }));
            QueryFilter queryFilter3 = new AndFilter(new QueryFilter[]
            {
                new ExistsFilter(InternalSchema.ItemColor),
                new ComparisonFilter(ComparisonOperator.NotEqual, InternalSchema.ItemColor, 0)
            });
            QueryFilter queryFilter4 = new AndFilter(new QueryFilter[]
            {
                new ExistsFilter(InternalSchema.MapiToDoItemFlag),
                new BitMaskFilter(InternalSchema.MapiToDoItemFlag, 1UL, true)
            });
            OrFilter orFilter = new OrFilter(new QueryFilter[]
            {
                new AndFilter(new QueryFilter[]
                {
                    new ExistsFilter(InternalSchema.MapiFlagStatus),
                    new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.MapiFlagStatus, 1),
                    new OrFilter(new QueryFilter[]
                    {
                        new NotFilter(new ExistsFilter(InternalSchema.ItemColor)),
                        new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.ItemColor, 0)
                    })
                }),
                new AndFilter(new QueryFilter[]
                {
                    new ExistsFilter(InternalSchema.TaskStatus),
                    new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.TaskStatus, 2)
                })
            });

            return(new SearchFolderCriteria(new AndFilter(new QueryFilter[]
            {
                SearchFolderValidation.GetSearchExclusionFoldersFilter(context, null, SearchFolderValidation.ExcludeFromRemindersSearchFolder),
                new OrFilter(new QueryFilter[]
                {
                    new AndFilter(new QueryFilter[]
                    {
                        queryFilter,
                        queryFilter2
                    }),
                    queryFilter3,
                    queryFilter4,
                    orFilter
                })
            }), new StoreId[]
            {
                context[DefaultFolderType.Root]
            })
            {
                DeepTraversal = true
            });
        }