SaaS CMS has officially launched! Learn more now.

Searching for pages with any value in property


How do I search for pages with any value in a given property? I can do a search for pages with a specific value in the property, but I can't figure out how to search for "not empty".

For example, this doesn't work:

var criterias = newPropertyCriteriaCollection
  new PropertyCriteria()
    Condition = CompareCondition.NotEqual,
    Name = "MyProperty",
    IsNull = false,
    Type = PropertyDataType.String,
    Value = ""

var pages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias);

An exception is thrown, "The crieria value cannot be null or empty. Set the IsNull property to search for null."

Any ideas?

Jan 12, 2012 7:22

This cannot be achived with just FindPagesWithCriteria and PropertyCriteria. You have to use a filter afterwards. See Or just a loop.


You can do the other way around, search for properties that is null.

Edited, Jan 12, 2012 10:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.