November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
No, I'm not specifically after the "About us" page - I want to be able to find any page based on its URL segment property - e.g. by searching for "Contact-us" (as in www.website.com/Contact-us) I want to get the Page Reference for the "Contact us" page.
This seems to be a better way of doing it as it gives me a simple Integer list of IDs rather than a collection of PageData objects, but it still doesn't work properly for the URL segment property - searching for "About-us" gives me a list of every ID from the page tree when I'd expect it to return just a single ID as there's only one page with the URL segment "About-us" in my page tree:
PropertyCriteria propertyCriteria = new PropertyCriteria();
propertyCriteria.Condition = EPiServer.Filters.CompareCondition.Equal;
propertyCriteria.Name = "PageURLSegment";
propertyCriteria.Type = PropertyDataType.String;
propertyCriteria.Value = "About-us";
propertyCriteria.Required = true;
EPiServer.DataAccess.PropertySearchDB propertySearchDB = new EPiServer.DataAccess.PropertySearchDB();
System.Collections.Generic.IList<int> pageList = propertySearchDB.FindPagesWithSingleCriteria(PageReference.StartPage.ID, propertyCriteria,
new PageData(PageReference.StartPage).LanguageBranch);
Is it possible to use the URL segment property as a search criteria? The following code gives me the first page in the page tree, rather than the "About us" page, which is what I'm looking for. If I search by "PageName" though - using "About us" as the value - it works fine.
PropertyCriteria propertyCriteria1 = new PropertyCriteria();
propertyCriteria1.Condition = EPiServer.Filters.CompareCondition.Equal;
propertyCriteria1.Name = "PageURLSegment";
propertyCriteria1.Value = "About-us";
propertyCriteria1.Type = PropertyDataType.String;
propertyCriteria1.Required = true;
propertyCriteriaCollection.Add(propertyCriteria1);
PageDataCollection rootPageDataCollection = searchPages.FindPagesWithCriteria(PageReference.StartPage, propertyCriteriaCollection);