[SharePoint Tip] LastItemModifiedDate and LastContentModifiedDate#

I've been working on this problem to find WSS sites that haven't been used for more then three months. SPWeb has a property called LastItemModifiedDate, to get the date when the last item in the SPWeb has been changed. However, the LastItemModifiedDate property applies only to sites returned by using one of the GetSubwebsForCurrentUser methods of the SPWeb class. Ok, but what if you want to get it from the rootweb?

Thanks to Tariq, he came up with the solution about using SPSite and the LastContentModifiedDate property:

SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPVirtualServerCollection vServers = globalAdmin.VirtualServers;
foreach (SPVirtualServer vs in vServers)

   foreach (SPSite site in vs.Sites) 
   { 
   Console.WriteLine(site.Url); 
   Console.WriteLine(site.LastContentModifiedDate); 
   }
}

This should do it :)

Monday, June 27, 2005 10:33:50 AM UTC #     | 

 

All content © 2012, Mart Muller
On this page
This site
Calendar
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
Archives
Sitemap
Disclaimer

Powered by: newtelligence dasBlog 1.9.7174.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts