Sitecore Query to get the latest item under a folder

I need to get the latest sitecore item created under specific folder as a data source. How I need to achieve this using sitecore query ?

  • You mean to get the latest Sitecore items in Multilist (Reference field)? And you are looking for Sitecore query to execute the same and provide the list of items?

    If this is the case then I am not sure If Sitecore query can do the same instead you can create your custom code and query the items which you want to show in Reference field.

    You can take a look sitecoretweaks.wordpress.com/.../ blog post.
  • The datasource of a rendering is normally not variable,
    I assume you need something to show the last article?.

    You can do this by making a component with a select article folder root field.
    In your c# code you can do somethings like: item.Children.OrderBy(i => i.Created).LastOrDefault()

    If you have many item and or a folder structure you can use the ContentSearch API.