Copied to clipboard

Flag this post as spam?

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


  • Keith Jackson 183 posts 552 karma points
    Feb 09, 2013 @ 01:56
    Keith Jackson
    0

    Umbraco 6 - New API - Children?

    I'm translating to the new API (or giving it a damn good try) but I'm coming unstuck in various places.

    Where I was previously using IPublishedContent, I now have IContent instead, however IContent has no Children property. How do I achieve the same kind of thing in the new API?

    This seems pretty fundamental.

  • Pinal Bhatt 298 posts 389 karma points
    Feb 11, 2013 @ 17:59
    Pinal Bhatt
    100

    Hope this helps:

    Use ApplicationContext.Current.Services.ContentService

    Suppose you have an object of IContent say "node"

    ApplicationContext.Current.Services.ContentService.GetChildren(node.Id)

     

     

  • Keith Jackson 183 posts 552 karma points
    Feb 11, 2013 @ 18:03
    Keith Jackson
    0

    I found this out the other day - it works, but it's a lot less discoverable than the old method. I tried to post the fix yesterday but 'our' was refusing to take my submissions for some odd reason.

    This is workable for me, I'm really stuck now figuring out how to get the URL back from the IContent interface.

  • Pinal Bhatt 298 posts 389 karma points
    Feb 11, 2013 @ 18:06
    Pinal Bhatt
    0

    me too stuck on getting Url form IContent object.

    Have one workaround but not sure if new APIs have any good solutiion for that: umbraco.library.NiceUrl(int) 

    umbraco.library.NiceUrl(IContent.Id)
Please Sign in or register to post replies

Write your reply to:

Draft