0
votes

Folks,

I have written a .Net Generic Event Handler to respond to JavaScript requests using JSON responses. All of that will be great(I think), but I need to figure out how to access the Content Nodes within my Content tree. Specifically, these nodes are event dates, and they are located below the event calendar node, which is under the root.

Root->EventCalendar->Events.

The issue I am having is that my ashx file lives in my usercontrols folder. Can anyone give me an idea as to how to "remotely" tap into the node structure? I have had no using a user control on a template, which is then used in a page. At that point, I have had no problem navigating the node structure, but in this case, where the control is not embedded in a page, I am at a loss.

I definitely appreciate any help, and I am sure you know by my question, I am a newbie to Umbraco!

Thanks, Jason

1

1 Answers

0
votes

You can access your content using the umbraco.NodeFactory.Node object. This provides access to all the published content and is the most efficient way of retrieving content.

So you could do something like:

INode calendarNode = umbraco.NodeFactory.Node.GetNodeByXpath("root/EventCalendar");

List<INode> events = calendarNode.ChildrenAsList;

foreach(var eventNode in events)
{
    DateTime createdDate = DateTime.Parse(eventNode.GetProperty("createDate").Value);
}