To create a console application in Visual Studio 2005
In Visual Studio 2005, on the File menu, point to New and click Project.
In the New Project dialog box, select a language, and then in the Project Type box, select Windows.
In the Template box, select Console Application.
In the Location box, type the path to the location where the application was created, and then click OK.
In Solution Explorer, right-click the References node, and then click Add Reference on the shortcut menu.
On the. NET tab of the Add Reference dialog box, select Windows SharePoint Services in the Components list, and then click OK.
In. vb and. cs files, add a using directive for the Microsoft.SharePoint namespace, as shown below.
Imports Microsoft.SharePoint
In the. vb or. cs file, add the following code to the Main method.
Overloads Sub Main(args() As String)
Dim siteCollection As New SPSite("http://Server_Name")
Dim sites As SPWebCollection = siteCollection.AllWebs
Dim site As SPWeb
For Each site In sites
Dim lists As SPListCollection = site.Lists
Console.WriteLine("Site: " + site.Name + " Lists: "
+ lists.Count.ToString())
Next site
Console.WriteLine("Press ENTER to continue")
Console.ReadLine()
End Sub 'Main
Click Start on the Debug menu, or press F5 to return the code.