Click or drag to resize
TaxonomyDocumentQueryExtensionsInEnabledCategoriesTQuery, TObject Method
Retrieves all pages which belong to any of the specified enabled categories.

Namespace: CMS.DocumentEngine
Assembly: CMS.DocumentEngine (in CMS.DocumentEngine.dll) Version: 10.0.0
Syntax
C#
public static TQuery InEnabledCategories<TQuery, TObject>(
	this IDocumentQuery<TQuery, TObject> query,
	params string[] categoryNames
)
where TQuery : Object, IDocumentQuery<TQuery, TObject>
where TObject : new(), TreeNode

Parameters

query
Type: CMS.DocumentEngineIDocumentQueryTQuery, TObject
Document Query which is being extended.
categoryNames
Type: SystemString
Category names

Type Parameters

TQuery
Actual type of query being extended.
TObject
Actual type of TreeNode instance.

Return Value

Type: TQuery

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDocumentQueryTQuery, TObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

If the query is parameterized with OnSite(SiteInfoIdentifier, Boolean) method the DocumentQuery searches enabled site categories first. When no site categories are found it falls back on global categories search.

Note: This method is a data filter and can be used directly only to modify the DocumentQuery (e.g. DocumentHelper.GetDocuments().InEnabledCategories("Category_A")). It cannot be used as a part of where condition (e.g. DocumentHelper.GetDocuments().WhereContains("DocumentName", "Article").Or().InEnabledCategories("Category_A")).

See Also