Try our conversational search powered by Generative AI!

Lars Smeby
Apr 24, 2014
  2156
(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

Comments

Please login to comment.
Latest blogs
Do not upgrade to EPiServer.CMS.Core 12.21.4 without reading this!

Todays update of EPiServer.CMS.Core 12.21.4 alters default sort order in an unexpected way, when you are working with muligple languages and have...

Tomas Hensrud Gulla | May 14, 2024 | Syndicated blog

Upgrade Optimizely CMS From v11 to v12

Why Upgrade? There are many improvements implemented in version 12, but most importantly is that the whole framework is migrated from .Net Framewor...

MilosR | May 13, 2024

Configured Commerce - Infrastructure Updates Ahoy!

I'm very happy to share an important milestone - we no longer have any customers in our legacy v1 environment!  This means that the Configured...

John McCarroll | May 10, 2024

A day in the life of an Optimizely Developer - Enabling Opti ID within your application

Hello and welcome to another instalment of A Day In The Life Of An Optimizely developer, in this blog post I will provide details on Optimizely's...

Graham Carr | May 9, 2024