Filtering the result of GetListRepositoryLocalObjects()
The GetListRepositoryLocalObjects() and GetRepositoryLocalObjects() methods take a filter parameter to filter the list of retrieved items. The filter class is Tridion.ContentManager.ContentManagement.RepositoryLocalObjectsFilter. You can filter the returned DOM document or objects by setting properties on the specific filter object.
Filtering items by using properties
To create a filter, first set its collection of item IDs, which is a string collection of Content Manager URIs and/or WebDAV URLs. Next, examine the properties available for your filter and set them to values that restrict the collection of items further. For example, the following code applies a filter to the returned items (as specified in myItemIds) so that they only contain Components by setting the ItemTypes property:
RepositoryLocalObjectsFilter filter = new RepositoryLocalObjectsFilter(engine.GetSession());
filter.ItemIds = myItemIds;
filter.ItemTypes = new ItemType[] { ItemType.Component };
Here are some examples of properties:
ItemTypes-
Specifies the type(s) of item you want to see.
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:
Schema type Description BundleDefines the Process Definition and metadata of a certain type of Bundle ComponentDefines the structure of the data fields of a certain type of Component EmbeddedDefines a structure to be embedded in another Schema MetadataDefines the structure of the metadata fields of a certain type of Component MultimediaDefines content and metadata for a certain type of Multimedia Component ProtocolDefines the parameters of a transport protocol RegionDefines the definition and metadata of a certain type of Region TemplateParametersDefines the parameters of a Template Building Block in a Compound Template VirtualFolderTypeDefines 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. You can specify which ID corresponds to which Template Type in the Content Manager configuration file (Tridion.ContentManager.config.xml, located in the config\ subfolder of your SDL Tridion root location), but by default, the values are set as follows:
Template Type ID CompoundTemplate4 AssemblyTemplate5 CSharpTemplate6 DreamweaverTemplate7 XsltTemplate8 You can add new IDs to the configuration file to represent custom Template Types you define yourself.
Filtering properties for each item returned by GetListRepositoryLocalObjects()
Each item that the GetListRepositoryLocalObjects() method returns has a number of properties, or columns. The columns returned are the columns specified in the following properties of the filter object:
BaseColumnsis a property which you can modify to specify which properties you would like to see returned.IncludeAllowedActionColumnsis a Boolean that specifies whether to include or exclude allowed action columns in the result.IncludeLocationInfoColumnsis a Boolean that specifies whether to include or exclude information about where each item is located: the ID and name of its container (organizational item), its path and its WebDAV URL. That is, the following properties:OrgItemIdOrgItemTitlePathURL
The BaseColumns property
The BaseColumns property offers a number of simple values to retrieve the most commonly requested sets of item properties:
Id- Retrieves only the ID (that is, the Content Manager URI) of each item.
IdAndTitle- Retrieves the ID and title of each item.
Default-
(default value if
BaseColumnsis left unspecified) Retrieves the following properties of each item:IdThe ID (that is, the Content Manager URI) of the item TitleThe title of the item TypeThe type of the item, represented as an integer ModifiedA timestamp indicating the moment when the item was last modified IsNewA boolean that indicates whether item is new or not FromPubA label indicating the originating Publication of the item, or the (translated) text "local copy". This property is used by the Content Manager Explorer GUI. OwningPublicationIdThe ID of the Publication in which the item was localized or where the local copy resides. OwningPublicationTitleThe title of the Publication in which the item was localized or where the local copy resides. SizeFor Multimedia Components, the size of the item. IconThis property is used by the Content Manager Explorer GUI only, you can ignore it. Extended-
Retrieves all the properties listed under the value
Default, and in addition, the following properties:IsPublishedA boolean that indicates whether the item has been published to any destination or not IsSharedA boolean that indicates whether the item is shared from another Publication, that is, whether it has been created in a parent Publication, or not IsLocalizedA boolean that indicates whether the item has been localized from another Publication, that is, whether it has been created in a parent Publication and subsequently been localized in this Publication, or not LockAn integer that indicates which type of lock, if any, is applied to this item TrusteeThe Content Manager URI of the user who locks this item, if any SubTypeThe subtype of this item. This property applies to Schemas, where it indicates the purpose of the Schema, or to Template Building Blocks, where it indicates the type of template (Dreamweaver, C#, .NET assembly, or a custom template type). FileExtFor Multimedia Components, the file extension of the binary file contained in the Multimedia Component MIMETypeFor Multimedia Components, the MIME type of the item