Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ross 3 posts 73 karma points
    Oct 22, 2015 @ 18:14
    Ross
    0

    Getting paged list of all nodes of particular type

    Hi,

    My content tree contains many types of node though I am looking to find the most efficient way of getting all nodes in the entire tree that are one of two types - all other nodes would be ignored. The returned list of nodes would be ordered by date and with paging, be a specific set of the results.

    Below is my thinking so far though I don't know how efficient this is so would appreciate any advice. The entire tree will eventually contain 1000's of rows

    IPublishedContent post = new Umbraco.Web.UmbracoHelper(this.UmbracoContext).TypedContentAtRoot().First();
    var x = post.Descendants().Where(x => x.DocumentTypeAlias == "DiscussionPost" && x.IsVisible()).OrderByDescending(x => x.CreateDate).Skip(intItemCount.Value).Take(intPageSize).ToList()
    

    Many thanks,

Please Sign in or register to post replies

Write your reply to:

Draft