Copied to clipboard

Flag this post as spam?

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


  • Paria 4 posts 24 karma points
    Jul 26, 2024 @ 11:36
    Paria
    0

    Find un-referenced items

    Hi, I am trying to find a way to find unused documents inside a folder, I tried IRelateionService but it doesn't work for me, it seems it can't find the correct relation or maybe I completely misused it. here is the code I used:

    var items = _contentService.GetPagedChildren(folderId, 0, int.MaxValue, out _);      
    List<int> list = new();
    
    foreach (var item in items)
    {
            var relations = _rationService.GetAllRelations(item.Id);
            if (!relations.Any())
            {
                list.Add(item.Id);
            }
    }
    

    relation have some IDs: an ID, child ID and parent ID, but none of the things I want, the parent is node parent and the child is node id itself. I couldn't find a way to get related documents. ps: by related documents I mean here: enter image description here

    I am using Umbraco 13.

Please Sign in or register to post replies

Write your reply to:

Draft