Lars Smeby
Apr 24, 2014
(6 votes)

Finding pages linking to an UnifiedFile

I’m working on a project where we’re using EPiServer 7.1 and the standard EPiServer Search. The files returned by the search are UnifiedFiles, but we wanted to display where on the site the files are being used.

I had trouble finding anyone else with the same problem, but finally I found a solution, though obsolete in EPiServer 7, in this thread.

I ended up using the code below:

var softLinkRep = ServiceLocator.Current.GetInstance<ContentSoftLinkRepository>();
var softLinks = softLinkRep.Load(searchHit.Url.ToHtmlString());

forech(var softLink in softLinks)
    var url = softLink.OwnerContentLink.GetFriendlyUrl();

Hope this can help someone!

Apr 24, 2014


Please login to comment.
Latest blogs
Optimizely Web Experimentation Metrics

Within the domain of Optimizely Web Experimentation Metrics, the emphasis is on objective key performance indicators (KPIs) selected to assess an...

Matthew Dunn | Sep 23, 2023 | Syndicated blog

Optimizely For you Intranet

Having been at Optimizely and in the CMS industry for nearly 16 years I have seen clients’ intranet requirements go from a simple site just to hous...

Robert Folan | Sep 22, 2023

Vulnerability in EPiServer.GoogleAnalytics v3 and v4

Introduction A potential security vulnerability was detected for Optimizely Google Analytics addon (including EPiServer.GoogleAnalytics and...

Bien Nguyen | Sep 20, 2023

Overriding Optimizely’s Content Recommendations Block to Implement Custom Recommendations

Introduction The Content Recommendations add-on for Optimizely CMS dynamically recommends content from your site tailored to the interests of each...

abritt | Sep 13, 2023 | Syndicated blog