Copied to clipboard

Flag this post as spam?

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


  • Rabea 34 posts 186 karma points
    Apr 19, 2019 @ 06:07
    Rabea
    0

    Get children of a node at controller level

    Hi,

    I am trying to get children of a node but so far i am not able to access them using Umbraco 7 methods, Can anyone help please?

     private void ContentService_Publishing(Umbraco.Core.Services.IContentService sender, Umbraco.Core.Events.ContentPublishingEventArgs e)
            {
                foreach (var node in e.PublishedEntities)
                {
                    if(node.ContentType.Alias == "competitions")
                    {
                        //Get childern of this node
                    }
    
  • Kevin Jump 2311 posts 14697 karma points MVP 7x c-trib
    Apr 19, 2019 @ 07:42
    Kevin Jump
    100

    Hi

    the Published function passes the content service as the sender object, so you can use that to get more content.

    sender.GetChildren(item.Id);
    
Please Sign in or register to post replies

Write your reply to:

Draft