Documentation Center

Properties for filtering GetListItems() results

You can specify a parameter on GetListItems() and GetItems() methods to filter list of items it retrieves.

The filter class is a subclass of Tridion.ContentManager.StronglyTypedFilter, and is different depending on the class from which you call GetListItems(). You can filter the returned DOM document or objects by setting properties on the specific filter object. These properties again depend on the class from which you call GetListItems(). Refer to the TOM.NET API reference documentation to find out about the types of filters and their properties.

To create a filter, examine the properties available for your filter and set them to values that restrict your returned items. For example, the following code applies a filter to the returned items so that they only contain Components by setting the ItemTypes property:

OrganizationalItemItemsFilter filter = new OrganizationalItemItemsFilter(engine.GetSession());
filter.ItemTypes = new ItemType[] { ItemType.Component };

Filter out items using the following properties:

ItemTypes
In the ItemsFilter class and its subclasses, specifies the type(s) of item you want to see. You can set its value to one of the following predefined constants:
If the container is a Publication:
  • ItemType.Folder (returns the root Folder)
  • ItemType.StructureGroup (returns the root Structure Group, if present)
  • ItemType.Category (returns all top-level Categories, if any exist)
If the container is a Folder or a Virtual Folder:
  • ItemType.Folder
  • ItemType.Schema
  • ItemType.Component
  • ItemType.ComponentTemplate
  • ItemType.PageTemplate
  • ItemType.TargetGroup
  • ItemType.TemplateBuildingBlock
  • ItemType.VirtualFolder
If the container is a Structure Group:
  • ItemType.StructureGroup
  • ItemType.Page
If the container is a Category:
  • ItemType.Category
  • ItemType.Keyword
LockFilter and LockResult
Causes only those items to be returned for which the item's LockType property equals LockResult after the LockFilter bitmask is applied.
SchemaPurposes
Causes only those items to be returned that are of the specified type(s) of Schema:
Component
Defines the structure of the data fields of a certain type of Component
Embedded
Defines a structure to be embedded in another Schema
Metadata
Defines the structure of the metadata fields of a certain type of Component
Multimedia
Defines content and metadata for a certain type of Multimedia Component
Protocol
Defines the parameters of a transport protocol
TemplateParameters
Defines the parameters of a Template Building Block in a Compound Template
VirtualFolderType
Defines a certain type of Virtual Folder
ComponentTypes
In the ItemsFilter class and its subclasses, causes only those items to be returned that are of the specified type(s) of Component:
Multimedia
A Component that contains binary (multimedia) data; that is, a Multimedia Component
Normal
A Component that contains normal structured data; that is, a normal Component
TemplateTypeIds
Causes only those items to be returned that are of the specified type(s) of Template Building Block. You can specify which ID corresponds to which Template Type in the Content Manager configuration file (Tridion.ContentManager.config.xml, located in %TRIDION_HOME%\config\), but by default, the values are set as follows:
Template TypeIDDescription
CompoundTemplate4A Template Building Block that is itself a Compound Template
AssemblyTemplate5A Template Building Block that contains a .NET assembly
CSharpTemplate6A Template Building Block that contains a C# fragment
DreamweaverTemplate7A Template Building Block that contains an Adobe Dreamweaver Template
XsltTemplate8A Template Building Block that contains an XSLT stylesheet

You can add new IDs to the configuration file to represent custom Template Types you define yourself.

BasedOnSchemas
In the OrganizationalItemItemsFilter, specify one or more Schemas to only return items that are based on the Schema(s).
Recursive
In the ItemsFilter class and its subclasses, set to true to also retrieve the contents of the subcontainers (and their subcontainers, and so on) of the container you are examining. For example, if you call GetListItems() from a Folder object that refers to a Folder named foo which itself contains a Folder bar, setting Recursive to true causes the call to retrieve items from bar also, while setting it to false causes the call to get items from foo only.