Copied to clipboard

Flag this post as spam?

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


  • Jimmy Connell 7 posts 27 karma points
    Apr 22, 2012 @ 22:48
    Jimmy Connell
    0

    Trying to query hive.

    I just installed the April 20 build of 5.1.   I added a custom controller so that I can query the hive and pass XML data back to the caller.

    This works:
    List<Content> = _hive.QueryContent()
    .OfRevisionType(FixedStatusTypes.Published)
    .Where(x => x.ContentType.Alias == "BookPage")
    .ToList();

    This doesn't work:
    List<Content> = _hive.QueryContent()
    .OfRevisionType(FixedStatusTypes.Published)
    .Where(x => x.Name == "My Content Name")
    .ToList();

    Am I doing something wrong or is this a bug?    I've been searching the forums/web for help, but can't find anything.   Any help would be greatly appreciated.

    Thanks,
    Jimmy

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 22, 2012 @ 22:53
    Dirk De Grave
    0

    Hi Jimmy,

    Querying content will return content, media, but also uers types for example, which doesn't necessarily have the "Name" attribute resulting in an exception... I've run into this myself and was able to workaround... See http://our.umbraco.org/forum/core/umbraco-5-general-discussion/30868-Check-if-node-exists

    And from looking at this thread, no one has actually find a decent solution to this

    Cheers,

    Dirk

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft