How to create a console application in Microsoft Visual Studio 2005

Source: Internet
Author: User


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.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.