Try Now
More in this section

Forums / Developing with Sitefinity / Getting the latest publication date

Getting the latest publication date

2 posts, 0 answered
  1. Saumitra
    Saumitra avatar
    127 posts
    10 Mar 2009
    04 Jun 2011
    Link to this post

    I'm using Sitefinity 3.7 Standard Edition. I have a requirement of displaying a list of all the news articles which have the publication date equal to the last publication date available in all the news items. How do I achieve this functionality if I'm using an external template for the list and setting the filter criteria dynamically ?

  2. Mike
    Mike avatar
    208 posts
    10 Dec 2007
    07 Jun 2011
    Link to this post
    Off the top of my head, how about:

    1.  Get a list of content items sorted by publication_date DESC:

    GetContent(int from, int max, string sortExp)
    (see: http://www.sitefinity.com/help/developer-manual/content-items-get.html#GetContent_by_from_max_sortExp)

    2.  Then take that top item, and repeat the query, this time adding the publication_date of the initial item to your filter array.

    In any case, you have to query the provider to find out what the latest date is.  There might be a more efficient way, but simply getting one record, sorted by publication_date seems simplest to me.

    Mike Sharp
2 posts, 0 answered