Copied to clipboard

Flag this post as spam?

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


  • Craig100 1078 posts 2366 karma points c-trib
    Jan 28, 2020 @ 23:41
    Craig100
    0

    Content Service get Descendants that are a particular doctype

    V7.15.3 UmbracoApiController

    I'm trying to get a list of nodes to delete that are of a particular docType (myPage) but am having difficulty with the syntax as I can't see anything that will work. I have pseudo code below.

    var cs = Services.ContentService;
    var currentItemList = cs.GetDescendants(1234).Where(x=>x.NodeTypeAlias == "myPage");

    Could someone tell me what the Lamda should be or isn't it done like this at all?

    Any advice appreciated.

    // Craig

  • Jonathan Distenfeld 105 posts 618 karma points
    Jan 29, 2020 @ 08:30
    Jonathan Distenfeld
    101

    Hi Craig,

    I think it should be something like this:

    cs.GetDescendants(1234).Where(x => x.ContentType.Alias == "myPage");
    

    ~ Jonathan

  • Craig100 1078 posts 2366 karma points c-trib
    Jan 29, 2020 @ 09:19
    Craig100
    0

    Thanks Jonathan, spot on.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies