How to get node by name programmatically in v6.0.2
Hi,
I have a parent content node which can be a hard-coded id. I want to find any child node of that parent by node name, programmatically in Umbraco 6.0.2.
I'm a little confused as to the best way to do this with the recent API updates. I'd rather do things the 'new' way rather than the 'legacy' way if there are such things.
Should I use the 'Document' object (http://our.umbraco.org/documentation/reference/Management/Documents/) or the 'Content' object (http://our.umbraco.org/documentation/reference/Management-v6/Models/Content) or the node factory or something else?
@Dan - are you wanting to get published content or from the database?
Am I right in thinking that the new ContentService API deals with content at the database level? (akin to the old Document) - whereas the IPublishedContent is akin to the old NodeFactory.Node?
How to get node by name programmatically in v6.0.2
Hi,
I have a parent content node which can be a hard-coded id. I want to find any child node of that parent by node name, programmatically in Umbraco 6.0.2.
I'm a little confused as to the best way to do this with the recent API updates. I'd rather do things the 'new' way rather than the 'legacy' way if there are such things.
Should I use the 'Document' object (http://our.umbraco.org/documentation/reference/Management/Documents/) or the 'Content' object (http://our.umbraco.org/documentation/reference/Management-v6/Models/Content) or the node factory or something else?
Thanks folks.
if by programmatically you mean in a dll ? not razor then i think you can use the ContentService in 6.0.2 (you definitely can in 6.1.x)
enumerate all children.
by name then replace
_cs.GetChildren
with_cs.GetChildrenByName(nodeId, name)
@Dan - are you wanting to get published content or from the database?
Am I right in thinking that the new
ContentService
API deals with content at the database level? (akin to the oldDocument
) - whereas theIPublishedContent
is akin to the oldNodeFactory.Node
?is working on a reply...