Copied to clipboard

Flag this post as spam?

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


  • James 2 posts 61 karma points
    Apr 01, 2014 @ 17:04
    James
    0

    Query unpublished nodes by property value

    Is there any way to query unpublised content by property value.

    E.g. I want to find an unpublised node where the value of a custom property 'code' == 'abc1234'

    Thanks

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Apr 03, 2014 @ 10:29
    Jeavon Leopold
    101

    Hi James,

    Welcome to Our!

    Yes there is, you will need to use the Content Service. Here is an example:

    var cs = ApplicationContext.Services.ContentService;
    var myCollection = cs.GetRootContent().FirstOrDefault().Descendants().Where(x => x.GetValue<string>("code") == "abc1234");
    

    This is assuming only one root node and filtering all descendants of that node.

    Jeavon

  • James 2 posts 61 karma points
    Apr 03, 2014 @ 18:08
    James
    0

    Thanks, I've got the idea now. 

Please Sign in or register to post replies

Write your reply to:

Draft