Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ivan 36 posts 177 karma points
    Sep 20, 2023 @ 05:16
    ivan
    0

    Get Property Used in Documents Umbraco Media

    I can't seem to find a property to Used in Documents in Media file. I want to know if the image files is used in a content. Is there any way we can get the content used in a media file image? Thanks

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Sep 20, 2023 @ 08:48
    Marc Goodson
    0

    Hi Ivan

    Which version of Umbraco 8 are you using?

    I think the concept of Tracking References, eg analysing on save whether a media item is included in one of the site's content properties and creating a relation between them, and the displaying the list in a 'Used in Documents' section on the Media Item was introduced in V8.6.

    so if you go to the 'info' panel of a Media Item and you don't see the list

    enter image description here

    Then that might be why... if you have a later version of Umbraco then the thing to check to see if it's working is whether you have the 'Related Media' relation type created:

    enter image description here

    If you are on a later version of V8 that 8.6 and you don't have this Relation Type created, then possibly something has gone awry in the upgrade.

    Then the other consideration is it's not 'foolproof', eg it will track links to media in rich text editors and media pickers that it knows about - but if you have a custom or third party property editor that hasn't implemented Tracking References, then any links to Media made in those could be missed!

    If you have an earlier version than 8.6 and can't upgrade to get this functionality then there is a package called Nexu that was the forerunner for this core functionality: https://our.umbraco.com/packages/backoffice-extensions/nexu/ that does the same job.

    regards

    marc

  • ivan 36 posts 177 karma points
    Sep 21, 2023 @ 15:15
    ivan
    0

    Hi Marc,

    Thanks for your response. My bad for not clearing my question. I mean is there any property at backend something like "media.GetProperty('UsedInDocuments')" ? Or is this available on newer version of umbraco 9, 10, 11 or 12 ..?

    Thanks

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Sep 22, 2023 @ 15:15
    Marc Goodson
    100

    Hi Ivan

    ha, sorry I misunderstood!

    Are you trying to get the references in the backoffice, in angularJS?

    trackedReferencesResource:

    https://github.com/umbraco/Umbraco-CMS/blob/511ee96c9e0c54480b5350fa0bcabe693bdc1e0a/src/Umbraco.Web.UI.Client/src/common/resources/trackedreferences.resource.js#L6

    (as that is what the backoffice is using).

    If you are looking to query things on the front end then this information is stored in the 'relations' database table and you could use something called the RelationsService to query the dependencies.

    https://our.umbraco.com/Documentation/Reference/Management/Services/RelationService/

    There is an introduction to Relations here generally if it's the first time you've seen it:

    https://our.umbraco.com/Documentation/Fundamentals/Data/Relations/

    Related Media and Related Document is the name of the relations to query!

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft