SPWeb.GetListsOfType 方法
Gets the lists of the specified type.
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Function GetListsOfType ( _
baseType As SPBaseType _
) As SPListCollection
用法
Dim instance As SPWeb
Dim baseType As SPBaseType
Dim returnValue As SPListCollection
returnValue = instance.GetListsOfType(baseType)
public SPListCollection GetListsOfType(
SPBaseType baseType
)
参数
baseType
类型:Microsoft.SharePoint.SPBaseTypeThe list 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.
Imports System
Imports Microsoft.SharePoint
Module ConsoleApp
Sub Main()
Using site As SPSite = New SPSite("https://localhost")
Using web As SPWeb = site.OpenWeb()
Dim lists As SPListCollection = web.GetListsOfType(SPBaseType.DocumentLibrary)
For Each list As SPList In lists
Console.WriteLine(list.Title)
Next
End Using
End Using
Console.ReadLine()
End Sub
End Module
using System;
using Microsoft.SharePoint;
namespace Test
{
class ConsoleApp
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
SPListCollection lists = web.GetListsOfType(SPBaseType.DocumentLibrary);
foreach (SPList list in lists)
{
Console.WriteLine(list.Title);
}
}
}
Console.ReadLine();
}
}
}