In this small tutorial i shall demonstrate how to hook up C# to use the Windows Sharepoint Services API (WSS). It’s fairly simple and straightforward. You need the following:

  1. A machine running Windows server 2003/08 with Sharepoint installed.
  2. Microsoft Visual Studio 2005.
  3. About 15 minutes.

For the purposes of this example, we will create a small console application that will list all the sites of a Sharepoint site. First of open Visual Studio and create a new Visual C# console application. Next step is adding the reference to the WSS API on our project. To do so, you can go on the explorer window, right click on the “References” and click “Add Reference…”. On the window that will show up choose “Windows Sharepoint Services” dll from the .NET packages.

Once this step is done, off to the code:

  1. span class=”st0″>"http://testsite");//this is the URL to the sharepoint site we want to connect to
  2. //looping through the collection of the sites
  3.             {
  4.                 Console.WriteLine(site.Name);
  5.             }
  6.             Console.ReadLine();
  7.         }
  8.     }
  9. }

From here on, sky is the limit! You can view a documentation of the WSS API here.