SPWeb.GetListsOfType method

Gets the lists of the specified type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPListCollection GetListsOfType(
	SPBaseType baseType


Type: Microsoft.SharePoint.SPBaseType

The list type.

Return value

Type: Microsoft.SharePoint.SPListCollection
The lists with the specified base list type.

Use this method to query a collection of lists of the specified base list type from the website.

The following example is a console application that gets the document libraries on a website, iterates through the lists, and prints each list title to the console.

using System;
using Microsoft.SharePoint;

namespace Test
   class ConsoleApp
      static void Main(string[] args)
         using (SPSite site = new SPSite("http://localhost"))
            using (SPWeb web = site.OpenWeb())
               SPListCollection lists = web.GetListsOfType(SPBaseType.DocumentLibrary);

               foreach (SPList list in lists)