Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    Nov 07, 2011 @ 17:25
    Barry Fogarty
    0

    uQuery GetChildMedia filtered query

    I would like to retrieve a list of child media via uQuery, based on a provided Media Type.  I have tried a few lambda expressions in my LINQ queries such as

    var allItems = downloadsFolder.GetChildMedia().Where(x => (x.GetType().ToString() == "Download")).OrderByDescending(x => x.getProperty("date").Value);

    and

    var allItems = downloadsFolder.GetChildMedia().Where(x => (x.getProperty("NodeTyleAlias").Value.ToString() == "Download"))

    but to no avail.  Essentially my issue is that I want to order the results by a custom dataetime property, and if there are standard 'File' media types in the list, the top query errors out with a null ref exception.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Nov 07, 2011 @ 17:53
    Hendy Racher
    1

    Hi Barry,

    Does the following work ?

    var allItems = downloadsFolder.GetChildMedia()
    .Where(x => x.ContentType.Alias == "Download")
    .OrderByDescending(x => x.GetProperty<DateTime>("date"))

    Cheers,

    Hendy

Please Sign in or register to post replies

Write your reply to:

Draft