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
Upgrading the code from a V7 site to V8 I have a class called by an UmbracoApiController which needs to get a list of children of a particular node.
To get the ContentService I've had to use :-
IContentService contentService = Current.Services.ContentService;
which is not what the docs say here: https://our.umbraco.com/documentation/reference/management/services/contentservice/
However, contentService only has a GetPagedChildren, it doesn't have the old GetChildren which V7 did.
All I want this for is to hold in an array or list so I can compare a value in each child with the value I get from the API to see if it exists.
Is there a better way to do this? I'm also aware that this is looking at the DB directly. I have a suspicion there's a way to look at the cache instead which would be quicker but can't find any info.
Any comments or advice would be appreciated.
You can do it in this way
Services.ContentService.GetPagedChildren(parentId, 0, int.MaxValue, out var count)
Thanks, that looks like it'll work.
It beats me why we don't have the simple cases of GetChildren() and GetDescendants(), but hey ho.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted