I've run into an issue when using FindPagesWithCriteria.I try to fetch all pages matching a set of PropertyCriteria but in some cases I do not get the pages I would expect.
The criterion I'm having problems with is this one:
Name = "TargetPage",
Condition = CompareCondition.Equal,
Required = false,
Type = PropertyDataType.PageReference,
Value = pageLinkToMatch.ID.ToString()
I have created pages with this TargetPage property set to various pages, and I'm then searching for pages having TargetPage set to a certain page.
I do not get matches when TargetPage has been set to point to a page within another PageProvider (in this case the PageProvider has the Multilanguage capability only). However, when set to a page within the regular CMS it works just fine.
What am I missing?
Hope you guys can give me some pointers, because I have hit the wall.
Have you tried with pageLinkToMatch.ToString() instead of pageLinkToMatch.ID.ToString()?Pagelinks to other providers also have a prefix and not just the ID to the page.
You also need to add a special criteria to tell the function to search over all providers, please see http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=57181
Yeah, I've tried using both just the ID as well as the entire PageLink string, no luck.
I don't get why it would be required to implement the PageProvider with Search capability when I only want to find pages within the actual CMS. A textual match would suffice.
I guess I could change the SP used in text searching to include PageReference property as well and match them that way, but I guess that has other side effects. The issue could probably be solved using a custom property as well, but I don't have the time.
I just find it odd that matching the page reference value requires searching for the page in the external page provder and fails.
Anyway, I gave up on this in the end and discarded the CMS for this feature entirely.
The CMS can't obvious search in your provider if you're not implementing the search method. It can't know how your data looks like.
If you want to find pages that links to other pages you can use the SoftLink API.
Yeah, I get that. But the (for me) not so obvious point is that searching in the page provider is required at all.
If I'm matching local pages on a property value, so what if that property value references a page in a different provider - it should still match.
StartPage- Page 1  PropertyPageReference TargetPage: "PP__101"- Page 2  PropertyPageReference TargetPage: "PP__102"- Page 3  PropertyPageReference TargetPage: "1"
[PageProvider (PP)]- PageProviderPage 1 [PP__101]- PageProviderPage 2 [PP__102]
Using FindPagesWithCriteria, search root in Start, with a PropertyCriteria as above (but with pageLinkToMatch.ToString() instead).What result would you expect if pageLinkToMatch.ToString() was PP__101?
I would expect the result to contain Page 1  as the TargetPage property of that page has the value of PP__101. But now it seems that we know that FindPagesWithCriteria will require that page to be found within the provider, and as Search capability is not implemented it is considered "not found" and Page 1 will not match.
Thank you for your feedback, and I will look into the SoftLink API!