Umbraco - Finding Root Node in C#

Viewed 25475

I'm working on a backend module, so Node.GetCurrent() is not an option. I need to find a way to call something like Node currentNode = new Node(parentNodeId); and get the root node of the site. I've seen samples in XSLT, but nothing for C#. Does anyone know how I can accomplish this?

Even just getting the ID of the root node so I can call new Node() would be great.

6 Answers

I frequently use this one. I like that it's relative so that if you have multiple root nodes you can target both without a foreach loop.

IPublishedContent topNode = Model.Content.AncestorOrSelf(1);
Related