Copied to clipboard

Flag this post as spam?

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


  • Anton 36 posts 67 karma points
    Jun 06, 2012 @ 11:22
    Anton
    0

    How to get a content node using API

    I'm trying to access a node in the content tree using the API but i can't find any documention covering such a basic task...

    I've got a simple structure Content > Home > About

    How do i retrieve the About node using the API using C#?

    In other CMS's it would be as simple as Context.GetItem("/content/home/about")

    How is this achieved with Umbraco v5?

    Thanks

  • Anton 36 posts 67 karma points
    Jun 07, 2012 @ 03:09
    Anton
    0

    Really anyone?  is it not that simple?

  • Theo Paraskevopoulos 33 posts 122 karma points
    Jun 07, 2012 @ 10:11
    Theo Paraskevopoulos
    0

    Assuming (a) you wish to use Razor on a 4.7 installation and (b) you only know the Name, you can do this:

    @Model.AncestorOrSelf(1).Where("Visible").Where("Name  == \"About\"")

    Let me know how this works for you

    Cheers

    Theo

  • Anton 36 posts 67 karma points
    Jun 07, 2012 @ 13:02
    Anton
    0

    I suppose that would work if the code is in a ViewPage...Howabout if the code was in a pure C# class without a context?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies