Testing the ChildrenOfType extension in 8.1.0 doesn't work, it just returns the same result with Children, that is all children. I guess this is a bug.
My only success was with:
var categories = parentNode.Children(c => c.IsDocumentType("category"));
or
var categories = parentNode.Children(c => c.ContentType.Alias == "category");
Getting all content using documenttype
I'm having trouble retrieving all contents based on the document type.
I have the following hierarchy in my Content section:
I need to retrieve only the content under the node Tours and all three of the have the same Document Type " tourType "
I used to do it like this on Umbraco 7:
How should it be done now in 8?
Hello Shelly,
in Umbraco 8 you should be able to achieve this using following:
Strongly typed:
Not strongly typed:
Hope I could help you.
Regards, Jonathan
Hi Jonathan,
I've tried your solution.
However, it's still not working for me.
I get a compilation error:
Compiler Error Message: CS0246: The type or namespace name 'TourType' could not be found (are you missing a using directive or an assembly reference?)
I've changed this value with the document type id and even tried others and I'm still not getting any results.
What am I doing wring here?
Hi Shelly
In addition to the suggestions above there is a 'ChildrenOfType' extension on IPublishedContent that you could also use:
regards
Marc
It might work with:
Then you can access children etc.
/Emil
Testing the ChildrenOfType extension in 8.1.0 doesn't work, it just returns the same result with Children, that is all children. I guess this is a bug.
My only success was with:
or
is working on a reply...