How to get the last modified item in SPList


  • Hello,

    i need to get the last modified item in my SPList. How can i do that without looping through all items?


    Best regards,
    Yavuz B.

    My Sharepoint Blog
    • Edited by Mike Walsh FIN Wednesday, June 16, 2010 11:44 AM list in Title changed to SPList to suit the programming forum
    Wednesday, June 16, 2010 11:36 AM


  • Build a SPQuery, set the OrderBy-option to the "Modified" field and take a row limit of 1.

    The first (and only, if any items inside the list) item the query results into will have the "Modified"-fieldvalue you are looking for.




    • Marked as answer by [Yavuz B.] Wednesday, June 16, 2010 1:42 PM
    Wednesday, June 16, 2010 1:14 PM