Try our conversational search powered by Generative AI!

Find pages with filename

Vote:
 
Please tell me there's a better way to do this than; public PageDataCollection findPagesWithFilename(PageReference pageLink, string filename) { PageDataCollection pages = new PageDataCollection(); foreach(PageData pd in Global.EPDataFactory.GetChildren(pageLink)) { string temp = EPiServer.DataAbstraction.PageType.Load(pd.PageTypeID).FileName; if(temp.Substring(temp.LastIndexOf("/")+1) == filename) pages.Add(pd); pages.Add(findPagesWithFilename(pd.PageLink,filename)); } return pages; }
#12334
Aug 21, 2005 10:46
Vote:
 
The code is ok for small amounts of pages and non recursive searches. But, you already know the filename you're searching for, why not map that to the pagetype by iterating through the PageType collection and look for it. When you know the pagetype, you can do a property search (FindPagesByCriteria(...)) with the PageTypeID as a search parameter. This should give you better performance if you're searching through a lot of pages. /Steve
#14082
Aug 22, 2005 7:18
Vote:
 
Ahhh. I need a vacation. Thank you!
#14083
Aug 22, 2005 14:02
* 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.