Copied to clipboard

Flag this post as spam?

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


  • Mirhat 11 posts 91 karma points
    Mar 17, 2018 @ 12:21
    Mirhat
    0

    I have document type with content picker and I want to know how to find all content that is referencing particular content.

    For example Content1 and Content2 is referencing Content 3. How can I get Content1 and Content 2 if I know id of Content 3.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Mar 17, 2018 @ 12:40
    Dave Woestenborghs
    0

    You could install my nexu package : https://our.umbraco.org/projects/backoffice-extensions/nexu/

    This stores all references as Umbraco relations.

    You could use the relations api to get the data you want : https://our.umbraco.org/documentation/Reference/Management/Services/RelationService

    Dave

  • Mirhat 11 posts 91 karma points
    Mar 17, 2018 @ 13:40
    Mirhat
    0

    Thank you Dave I will try it

  • Pawel Bres 39 posts 160 karma points c-trib
    Mar 17, 2018 @ 17:24
    Pawel Bres
    0

    You can also use Examine for that. Just create searchCriteria and set the search query like this:

    var searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"]; var searchCriteria = searcher.CreateSearchCriteria(); searchCriteria.Field("yourContentPickerProperty", contentId); var searchResults = searcher.Search(searchCriteria);

  • Mirhat 11 posts 91 karma points
    Mar 17, 2018 @ 17:49
    Mirhat
    0

    I have new problem contentId is int but in database yourContentPickerProperty is stored as umb://document/0dec2b61774547b1b96956895d59f231

  • Mirhat 11 posts 91 karma points
    Mar 17, 2018 @ 20:21
    Mirhat
    0

    I have finished with something like this

    var searchCriteria = searcher.CreateSearchCriteria();
    var key = "umb://document/" + podkategorija.GetKey().ToString().Replace("-", "");
    searchCriteria.Field("kategorija", key);
    var searchResults = searcher.Search(searchCriteria);
    
Please Sign in or register to post replies

Write your reply to:

Draft