1.首先需要引用Mircosoft.SharePoint.dll。位于C盘的。C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI文件夹下。
2.添加using. using Microsoft.SharePoint;
3.实例化网站集对象
SPSite site=new SPSite("http://XXXX");
获取根网站
SPWeb web=site.RootWeb;
foreach(SPList list in web.Lists)
{Page.Response.Write(list.Title+"<br/>");
}
//释放
web.Dispose();
site.Dispose();