public static void ProcessContentFilter(string contentFilter, int contentFilterLCID, PSCmdlet cmdlet, IFilterBuilderHelper mapper, out RestrictionData restriction, out string normalizedFilter)
        {
            Exception ex = null;

            try
            {
                QueryParser queryParser  = new QueryParser(contentFilter, ObjectSchema.GetInstance <ContentFilterSchema>(), QueryParser.Capabilities.All, (cmdlet != null) ? new QueryParser.EvaluateVariableDelegate(cmdlet.GetVariableValue) : null, new QueryParser.ConvertValueFromStringDelegate(ContentFilterBuilder.ConvertValueFromString));
                QueryFilter parseTree    = queryParser.ParseTree;
                Restriction restriction2 = ContentFilterBuilder.BuildRestriction(parseTree, mapper);
                restriction      = RestrictionData.GetRestrictionData(restriction2);
                restriction.LCID = contentFilterLCID;
                normalizedFilter = parseTree.GenerateInfixString(FilterLanguage.Monad);
                return;
            }
            catch (InvalidCastException ex2)
            {
                ex = ex2;
            }
            catch (ParsingException ex3)
            {
                ex = ex3;
            }
            catch (ArgumentOutOfRangeException ex4)
            {
                ex = ex4;
            }
            throw new InvalidContentFilterPermanentException(ex.Message, ex);
        }
Esempio n. 2
0
 internal void ParseQueryFilter(StoreSession storeSession, QueryFilter queryFilter)
 {
     this.Restrictions = new RestrictionData[]
     {
         RestrictionData.GetRestrictionData(storeSession, queryFilter)
     };
 }
Esempio n. 3
0
 internal void ParseQueryFilters(StoreSession storeSession, ReadOnlyCollection <QueryFilter> queryFilters)
 {
     this.Restrictions = new RestrictionData[queryFilters.Count];
     for (int i = 0; i < queryFilters.Count; i++)
     {
         this.Restrictions[i] = RestrictionData.GetRestrictionData(storeSession, queryFilters[i]);
     }
 }
Esempio n. 4
0
 internal void ParseRestrictions(params Restriction[] rest)
 {
     this.Restrictions = new RestrictionData[rest.Length];
     for (int i = 0; i < rest.Length; i++)
     {
         this.Restrictions[i] = RestrictionData.GetRestrictionData(rest[i]);
     }
 }
Esempio n. 5
0
        void IFolder.GetSearchCriteria(out RestrictionData restriction, out byte[][] entryIds, out SearchState state)
        {
            MrsTracer.Provider.Function("StorageFolder.GetSearchCriteria: {0}", new object[]
            {
                this.DisplayNameForTracing
            });
            restriction = null;
            entryIds    = null;
            state       = SearchState.None;
            SearchFolderCriteria searchFolderCriteria = null;

            try
            {
                using (this.Mailbox.RHTracker.Start())
                {
                    searchFolderCriteria = this.CoreFolder.GetSearchCriteria(false);
                }
            }
            catch (ObjectNotInitializedException ex)
            {
                MrsTracer.Provider.Warning("GetSearchCriteria failed with ObjectNotInitializedException, ignoring.\n{0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(ex)
                });
            }
            if (searchFolderCriteria != null)
            {
                state = (SearchState)searchFolderCriteria.SearchState;
                if (searchFolderCriteria.FolderScope != null)
                {
                    entryIds = new byte[searchFolderCriteria.FolderScope.Length][];
                    for (int i = 0; i < searchFolderCriteria.FolderScope.Length; i++)
                    {
                        entryIds[i] = StoreId.GetStoreObjectId(searchFolderCriteria.FolderScope[i]).ProviderLevelItemId;
                    }
                }
                restriction = RestrictionData.GetRestrictionData(this.Mailbox.StoreSession, searchFolderCriteria.SearchQuery);
            }
        }