Programmatically Retrieve List of Document Libraries

The following code snippet is used to retrieve the list of document libraries.

SPWeb _web = SPContext.Current.Web;


SPListCollection ListColl = _web.Lists;


foreach (SPList _lst in ListColl)

{


if (_lst.BaseTemplate == SPListTemplateType.DocumentLibrary)

{

LibList.Items.Add(_lst.Title);

}

}

BaseTemplateType can be used to identify the Type of list.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>