Documentation > CMS Template API Library > Context > FilterStatus

FilterStatus

Contains the names of statuses like "Live" and "Stage" which are considered valid in the current context. There is usually always a blank "" which signifies that assets without workflow are valid. Affects all calls which use filter status including Asset.Load(), Asset.GetFilterList(), Asset.GetFileList(), and Asset.GetFolderList() unless specifically set by those functions. This is a ReadOnlyCollection. You may read it, but not modify it. Reading this type of collection is almost identical to reading a List.

Type

ReadOnlyCollection<String>

Value

The filter status.

Code Example

C#

Sample:
 
             
             
             //Print the names of statuses, note on will usually be blank.  This is normal.
             foreach(string statusName in context.FilterStatus)
             {
               Out.WriteLine("Status name: " + statusName);
             }
             
             // print the number of states.  Includes one blank.
             Out.WriteLine("Number of states: " + context.FilterStatus.Count);
             
             // Does the FilterStatus include the "Live" state?
             // Warning, this is case sensitive.  The names are the names of File assets in the "/System/States" folder.  This is the case that is used.
              Out.WriteLine("Contains Live? : " + context.FilterStatus.Contains("Live"));
            
            

Connect with Crownpeak