Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

How to get the root node in Umbraco 6/7

$
0
0

Hey, I am trying to get the root node in Umbraco 7 (case should be the same for Umbraco 6).

The suggestions I found here don't work.

http://stackoverflow.com/questions/11940537/umbraco-finding-root-node-in-c-sharp

UmbracoHelper.TypedContent(-1) returns null

Umbraco.Content(-1) returns an empty 'dynamic'

var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
    var rootNode = umbracoHelper.TypedContentSingleAtXPath("//root"));

..results in the exception "ContentTypeService failed to find a content type with alias "root"".

 

Any ideas? Are we supposed to still use the Node(-1) method for this? I thought "Node" is a thing from the past.

Are we supposed to access the root node at all in Umbraco 6/7?

On an different but related note: I think it would be a good idea to agree on one name for a Node/Item/Page/Content and work towards consistency in the API on this point, because it is becoming hard to distuingish between all the terms that are used for what was called a Node in Umbraco 4 and is now called Content in the Content API, but a CurrentPage when we are in a Controller or Razor. This is especially confusing for beginners...


Viewing all articles
Browse latest Browse all 72689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>