none
last modified date and time in SharePoint Site RRS feed

  • Question

  • hi

    Can you plz help
    how to get  last modified date and time in SharePoint Site  any list or any content or any page ...

    i am using <PublishingWebControls:LastModifiedIndicator runat="server" /> i.e is for only getting last udate page

    i need last update data and time on any place in  entire site
    Wednesday, October 28, 2009 6:08 AM

Answers

  • Hi there.

    You can use the LastItemModifiedDate property of the Web object.

    Like so:

    using (SPSite site = new SPSite("http://<YOURSITECOLLURL>"))
    {
       using (SPWeb web = site.OpenWeb("<YOURSITE>"))
       {
         DateTime dt = web.LastItemModifiedDate;
         Console.WriteLine("Last modified date: " + dt.ToString());
      }
    }

    Hope this helps.

    Regards,
    Magnus
    My blog: InsomniacGeek.com
    • Marked as answer by kushal1239 Wednesday, October 28, 2009 9:29 AM
    Wednesday, October 28, 2009 8:31 AM

All replies

  • You should be able to get it from the Site Usage Data and Summary. Site Settings->Site Administration-> View Site Usage Data or View Site Collection Usage Summary. Check the API to get it in code.

    Regards
    Prasad
    Wednesday, October 28, 2009 6:31 AM
  • Hi there.

    You can use the LastItemModifiedDate property of the Web object.

    Like so:

    using (SPSite site = new SPSite("http://<YOURSITECOLLURL>"))
    {
       using (SPWeb web = site.OpenWeb("<YOURSITE>"))
       {
         DateTime dt = web.LastItemModifiedDate;
         Console.WriteLine("Last modified date: " + dt.ToString());
      }
    }

    Hope this helps.

    Regards,
    Magnus
    My blog: InsomniacGeek.com
    • Marked as answer by kushal1239 Wednesday, October 28, 2009 9:29 AM
    Wednesday, October 28, 2009 8:31 AM
  • hi
    Magnus

    thanks for giving solution
     i have done that but i am getting different date not in my SharePoint Date and Time

    for example if i am update one list in web that update date time is 10/28/2009 10:28:47 AM

    but in web.LastItemModifiedDate Showing another date time that is to different

    that date time is Updating
    Wednesday, October 28, 2009 10:58 AM
  • You can get this information using SharePoint REST:

    Try using below endpoint on browser:

        siteUrl/_api/web

    It will return "LastItemModifiedDate".

    Please Vote(^) and mark as Answer if it helps you.

    Tuesday, July 9, 2019 12:38 PM