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
ItemsFilterclass 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: LockFilterandLockResult-
Causes only those items to be returned for which the item's
LockTypeproperty equalsLockResultafter theLockFilterbitmask 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
ItemsFilterclass 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 Type ID Description CompoundTemplate4 A Template Building Block that is itself a Compound Template AssemblyTemplate5 A Template Building Block that contains a .NET assembly CSharpTemplate6 A Template Building Block that contains a C# fragment DreamweaverTemplate7 A Template Building Block that contains an Adobe Dreamweaver Template XsltTemplate8 A 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
ItemsFilterclass and its subclasses, set totrueto also retrieve the contents of the subcontainers (and their subcontainers, and so on) of the container you are examining. For example, if you callGetListItems()from aFolderobject that refers to a Folder namedfoowhich itself contains a Folderbar, settingRecursivetotruecauses the call to retrieve items frombaralso, while setting it tofalsecauses the call to get items fromfooonly.