November Happy Hour will be moved to Thursday December 5th.

Files in Search Results - how to get page the file is on?

Vote:
 

Our client would like to have a breadcrumb indicating the hierachy of pages leading to the page that holds each file that is returned in EPiServer search results, when files are returned. This looked straightforward as the search results are a collection of PageData objects, and we should be able to navigate up to the pages parent page(s) until we reach the start page for the search, and then dispaly this hierarchy of pages as the breadcrumb.

However, we hit a serious snag when we found that the PageData objects returned for file search result items is completely missing all PageRef, PageGuid, and Parent page reference. In short, the PageData object seems to have absolutely no link to the page tree at all, so we have no way to determine the page that holds the file in the search results.

Does anyone know of a solution to this?

#54459
Oct 17, 2011 22:36
Vote:
 

Find all use of a file

UnifiedFile File;

SoftLinkCollection referers = SoftLink.Load(File);

foreach (SoftLink refLink in referers)
                {

                    p = DataFactory.Instance.GetPage(refLink.OwnerPageLink);

 

 

If its a Page File

PageData ownerPage = UnifiedDirectory.GetOwnerPageFromVirtualPath(File.VirtualPath);
           

#54475
Oct 18, 2011 15:36
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.