Share via


Getting last modifed date of a SharePoint Site

Question

Friday, June 28, 2013 1:31 PM

Hi everybody,

I want to get the last modified date/time of a SharePoint Site.My actual requirement is to fetch the Sites that are idle for 1 year.

I have already verified the web.LastItemModifiedDate property, but this time doesnot change when the metadata of the Site like Site title, Site description etc. changes.

I have also tried using the ChangeLog but the problem is that the log retention period to a value more than 1 year which would considerably increase the database size.

Although not recommended, I've just checked the "LastMetadataChange" field of the Webs table in content database. It gets updated when the Site metadata changes but it also sometimes gets updated automatically(may be, when a timer job runs/usage data gets recorded etc.) Hence, I'm unable to rely on that column.

It would be great, if you can provide a solution for this.

All replies (11)

Friday, June 28, 2013 4:03 PM ✅Answered

Hi Kalpana,

Can you look into this, It provides a powershell script and other link some C# for the same:

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/47e49a70-c12b-4e97-bb47-8c09e6bfb9f0/powershell-iterate-sitecollection-and-webs-list

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2c74a56b-18b6-4dc9-b368-b96dcf7be3ec/last-modified-date-and-time-in-sharepoint-site

Please don't forget to 'mark answer/propose answer' or 'vote as helpful' as appropriate.


Friday, June 28, 2013 5:53 PM ✅Answered

If you also like to get the last item modified in a web use can use the property in SPWeb.ItemLastModified. For lists there is a property too:

SPList.ItemLastModified

Another thing that i can recommend you is the contentiterator class which provedes a non blocking way to get all webs and even list.

Content Iterator: http://msdn.microsoft.com/en-us/library/ff798376.aspx

Kind regards
Stefan

http://www.n8d.at/blog
Follow me on Twitter: StFBauer | n8design

Microsoft Community Contributor 2011 / 2012
MCTS - SharePoint / WSS Configuration and Development


Friday, June 28, 2013 3:23 PM

One of friend have changed the last modified date and name in list ..if you are looking for the same thing so i will update you soon.


Friday, June 28, 2013 4:11 PM

hi Kalpana,

you can find the site last modified time through "Storage Metrics"

>>Site Action>>Site Settings>>Storage Metrics under Site collection Admin category

there you can see the each site, List,Libraries last modified time

Regards,

karim

Please remember to mark your question as "answered" if this solves your problem.


Friday, June 28, 2013 5:24 PM

$site = Get-SPSite http://server/sites/sitecollection
$site.LastContentModifiedDate

Monday, July 1, 2013 5:32 AM

Thanks for you reply Yogesh...but my requirement is only to fetch the last modified date of a SharePoint site..


Monday, July 1, 2013 5:33 AM

Thanks for your reply Karim...Basically, we are doing some integration with a third part tool...so somehow I need to fetch the data using the Object model and send it to the tool...


Monday, July 1, 2013 5:36 AM

Thanks for your reply Sairao..I have checked the LastContentModifedDate of site collection...the problem is that it gets updated automatically some times( for eg., when a specific timer job runs or site usage report is collected). Since we need to fetch the sites that are idle for 1 year, and the LastContentModiifedDate gets updated frequently, we are not able to rely on it


Monday, July 1, 2013 5:38 AM

Thanks for your reply Stefan. I have tried SPWeb.LastItemModifiedDate but the only problem is that it doesn't get changed when someone changes the Site metadata like Site title, description etc. However, we need to fetch the sites that has been modified by a user in any way(Site metadata / content)


Monday, July 1, 2013 5:41 AM

Thanks for your reply Mahesh. However, I cannot use LastItemModifiedDate as it is not getting changed when someone changes the Site metadata, say title, description, activating/deactivating a feature etc. We need those changes to be included as well...


Wednesday, July 10, 2013 10:20 AM

Thanks for the replies...Somehow, we have fixed only as much as web.LastItemModifiedDate can handle...