Quantcast
Channel: list – farhanfaiz's Weblog – SharePoint 2003/07/10/13/16/19 & Online
Viewing all articles
Browse latest Browse all 9

SharePoint 2007: Last Modified Date of Lists / Document Libraries

$
0
0

Scenario: We need to find the last access / modified date of all document libraries in a site collection.

Resolution:

Following code solved our issue

SPSite spSite = new
SPSite(“SiteCollectionURL”);

SPWeb spWeb = spSite.OpenWeb();

SPListCollection listColl = spWeb.Lists;

DateTime lastModifiedDate;

foreach (SPList list in listColl)

{     

if (list.BaseType == SPBaseType.DocumentLibrary)

{     

lastModifiedDate = list.LastItemModifiedDate;

Console.WriteLine(“Document Library Title:” + list.Title + “\nLast Modified Date:” + lastModifiedDate + “\n\n”);

}

}

P.S. Please change BaseType as per your requirement for Lists etc or remove this check all together.



Viewing all articles
Browse latest Browse all 9

Trending Articles