3

I'm wondering if there is some API/Code/Trick on Sitecore to fetch all linked/related Items to a given Sitecore item, just like we have on the XP Admin interface?

My goal here is to find all pages using a given item as a data source of one of its renderings.

enter image description here

  • 2
    Something like Sitecore.Globals.LinkDatabase.GetReferrers({current item}) or I missed the point of your question? – Marek Musielak Aug 15 at 18:43
  • Actually, that's exactly what I was looking for, thanks Marek :) – Hugo Santos Aug 15 at 19:03
4

You can use from code: ItemLink[] itemLinks = Globals.LinkDatabase.GetReferrers(item);

Or from Content Editor you can use Link ribbon button from Navigate tab:

enter image description here

1

You can use Link Database via GetReferrers method. e.g.

var links = Globals.LinkDatabase.GetReferrers(item);
  if (links == null)
    return new Item[0];
  var linkedItems = links.Select(i => i.GetSourceItem()).Where(i => i != null);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.