Documentation > CMS Template API Library > Asset > GetFilterList(FilterParams)

GetFilterList

Get a List of Assets from the CMS, based on a custom filter, searching recursively from this folder asset.

NOTE: If using GetFilterList in a scenario that has multiple levels of nested folders within the returned list of assets, please consider setting the "useAssetsPathFilter" configuration flag to TRUE. When enabled, this API will use the folder table in place of the generated temp table we now use for folders in filter lists.

public List<Asset> GetFilterList(FilterParams)


Returns

The filtered list of assets.

Parameters

NameDescriptionType
filterParams The filter params. set ExcludeProjectTypes to false on Params object if you want new project related types to be returned. CrownPeak.CMSAPI.FilterParams

Code Example

C#

Sample:
FilterParams filter = new FilterParams();

// Filter on an asset property
filter.Add(AssetPropertyNames.Label, Comparison.Equals, "About Us");

// Filter on a field
filter.Add("headline", Comparison.Equals, "About Us");

// Filter by a date instead of a string
filter.Add(AssetPropertyNames.ModifiedDate, Comparison.GreaterThan, new DateTime(2010, 11, 15));

List<Asset> files = folderAsset.GetFilterList(filter);

// Get Items named "Index" in the folder object that are not "Archived" or "Retired"
FilterParams fParams = new FilterParams();
fParams.Add(AssetPropertyNames.Label, Comparison.Equals, "Index");
fParams.ExcludeFilterStatus = Util.MakeList("Archived","Retired");
List<Asset> listOfIndexFiles = asset.Parent.GetFilterList(fParams);    

Connect with Crownpeak