Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
According to the documentation here (http://our.umbraco.org/documentation/Reference/Querying/uQuery/), I should now be using UmbracoHelper instead of uQuery, but I can't seem to find equivalent methods for things like GetNodesByType()
Does anyone have a deeper understanding of this?
The UmbracoHelper documentation doesn't seem fully fledged as yet.
Thanks in advance,
I think you have to roll your own. Given a published content instance, you could run the following LINQ query:
var children = node.Children.Where(n => n.Type.Equals("ChildDocTypeAlias"))
I tend to use the typed methods, like so:
IPublishedContent home = Umbraco.TypedContentAtRoot().FirstOrDefault();
IEnumerable<IPublishedContent> myDocumentTypes = home.Descendants("MyDocumentType");
Note, .Descendants is an extension of IPublishedContent in Umbraco.Web.
These are both fine answers, though to be honest not something I couldn't do already.
However, I was rather hoping there would be some equivalent methods to the uQuery methods.
If you take a look at uQuery, it's now in Umbraco.Core namespace, you'll see a whole load of really useful methods such as GetNodeIdByType and others.
The trouble with uQuery now, as far as I can tell, is that all returned objects are are of Umbraco.NodeFactory.Node type, which is now obsolete
I have written a method which converts Node to IPublishedContent and vice versa, but this only serves to allow me to use uQuery, which I'm trying to move away from.
Marking yours as the answer Andrew as it does work, but I guess the real answer to my question is that equivalent methods don't exist
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted