TaxonomyDocumentQueryExtensionsWithTagTQuery, TObject Method |
Retrieves only pages which are assigned to the given tagName. Omitting tagGroupName parameter causes the selection of the tag across all tag groups.
Namespace: CMS.DocumentEngineAssembly: CMS.DocumentEngine (in CMS.DocumentEngine.dll) Version: 10.0.0
Syntax public static TQuery WithTag<TQuery, TObject>(
this IDocumentQuery<TQuery, TObject> query,
string tagName,
string tagGroupName = null
)
where TQuery : Object, IDocumentQuery<TQuery, TObject>
where TObject : new(), TreeNode
Parameters
- query
- Type: CMS.DocumentEngineIDocumentQueryTQuery, TObject
Document Query which is being extended. - tagName
- Type: SystemString
Tag name. - tagGroupName (Optional)
- Type: SystemString
Tag group name.
Type Parameters
- TQuery
- Actual type of query being extended.
- TObject
- Actual type of TreeNode instance.
Return Value
Type:
TQueryUsage 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
Multiple tags can have the same name when assigned to a different tag group. Omitting tagGroupName parameter causes the selection of the tag across all tag groups.
Note:
This method is a data filter and can be used directly only to modify the DocumentQuery (e.g. DocumentHelper.GetDocuments().WithTag("Tag_A")).
It cannot be used as a part of where condition (e.g. DocumentHelper.GetDocuments().WhereContains("DocumentName", "Article").Or().WithTag("Tag_A")).
See Also