How to programatically get all linked items for a given Sitecore item?Admin UI for PRC and REP roles not...

Angles between vectors of center of two incircles

How best to join tables, which have different lengths on the same column values which exist in both tables?

Reducing contention in thread-safe LruCache

Earliest evidence of objects intended for future archaeologists?

!I!n!s!e!r!t! !b!e!t!w!e!e!n!

How can I train a replacement without them knowing?

Independence of Mean and Variance of Discrete Uniform Distributions

Do predators tend to have vertical slit pupils versus horizontal for prey animals?

How do we test and determine if a USB cable+connector is version 2, 3.0 or 3.1?

Have made several mistakes during the course of my PhD. Can't help but feel resentment. Can I get some advice about how to move forward?

Is there a commercial liquid with refractive index greater than n=2?

Starships without computers?

iPad or iPhone doesn't charge until unlocked?

Just one file echoed from an array of files

Would it be illegal for Facebook to actively promote a political agenda?

Can others monetize my project with GPLv3?

Have only girls been born for a long time in this village?

Atmospheric methane to carbon

Check disk usage of files returned with spaces

Does the Temple of the Gods spell nullify critical hits?

Are unaudited server logs admissible in a court of law?

Which basis does the wavefunction collapse to?

What causes burn marks on the air handler in the attic?

Can 'in-' mean both 'in' and 'no'?



How to programatically get all linked items for a given Sitecore item?


Admin UI for PRC and REP roles not working on Azure PaaS on vanilla Sitecore 9Sitecore Related Items to publish only Related Media items of an itemHow to prevent an item from being moved to another folder accidentally?Remove certain items from control panel for some usersIs there a page on which I can view all Sitecore jobs running?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







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










share|improve this question




















  • 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


















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










share|improve this question




















  • 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














3












3








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










share|improve this question














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







admin-pages related-items






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 15 at 18:41









Hugo SantosHugo Santos

1,4291 gold badge3 silver badges20 bronze badges




1,4291 gold badge3 silver badges20 bronze badges











  • 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














  • 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








2




2





Something like Sitecore.Globals.LinkDatabase.GetReferrers({current item}) or I missed the point of your question?

– Marek Musielak
Aug 15 at 18:43





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





Actually, that's exactly what I was looking for, thanks Marek :)

– Hugo Santos
Aug 15 at 19:03










2 Answers
2






active

oldest

votes


















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






share|improve this answer



































    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);





    share|improve this answer




























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "664"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f20525%2fhow-to-programatically-get-all-linked-items-for-a-given-sitecore-item%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      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






      share|improve this answer
































        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






        share|improve this answer






























          4












          4








          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






          share|improve this answer















          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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 15 at 19:27









          Gatogordo

          13.6k2 gold badges20 silver badges69 bronze badges




          13.6k2 gold badges20 silver badges69 bronze badges










          answered Aug 15 at 18:48









          Vlad IobagiuVlad Iobagiu

          14.3k2 gold badges13 silver badges40 bronze badges




          14.3k2 gold badges13 silver badges40 bronze badges




























              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);





              share|improve this answer






























                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);





                share|improve this answer




























                  1












                  1








                  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);





                  share|improve this answer













                  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);






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 15 at 18:44









                  josedbaezjosedbaez

                  1,2578 silver badges29 bronze badges




                  1,2578 silver badges29 bronze badges

































                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Sitecore Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f20525%2fhow-to-programatically-get-all-linked-items-for-a-given-sitecore-item%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...