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
I'm trying to get all nodes of a certain type - regardless of publish state (hence why I'm using ContentService). I figured I'd get all nodes and filter from there.
From the code as well as other forum threads it seems like I want ContentService.GetPagedDescendants() - but I'm running into an issue where it returns 0 elements. Even more curiously, the out totalRecords does return the proper number.
Here's my content structure:
And the code:
As you can see, descendants has 0 elements but returnCount is 3 (as is expected).
I am also getting this, even when I pass in -1 for the rootNode.Id. I am able to do below:
IEnumerable<IContent> z = contentService.GetPagedDescendants(-1, 1, 1000, out totalStale).Where(x => x.Published).AsEnumerable<IContent>()
But 0 results are returned. How 0dd. Does it work for you when you move the code into a Razor View and Use IPublishedContent instead? Depending on what you are trying to accomplish, this might be a viable alternative.
I haven't tried anything with IPublishedContent as I need all IContent, not just published elements. This is being used in an on save handler so there's no view for it.
Change our "pageIndex" to 0. instead or 1.
Had the same problem, but @Martijn helped me with this :) !
This is what I have:
IEnumerable<IContent> Children = Services.ContentService.GetPagedDescendants(pageId, 0, 5, out long TotalChildren, null, Ordering.By("date", Direction.Ascending, null, true));
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted