I am a new to SharePoint webservices and now working on customizing webservices for sharepoint. Here is a sample code for creating a site in SharePoint using it’s webservices.

Creating Site:

To create a site, project requires a methods to access sites for creating and deleting. Those methods and properties are available in admin webservice.


is a admin webservice available in directory called Root:Program FilesCommon FilesMicrosoft Sharedweb server extensions12ADMISAPIadmin.asmx

Add this reference to the project, and change the reference name to SPAdminService.
The following code helps to create a site for the particular URL.

 protected void createSite()
string siteURL=”http://servername:port/site”;   Site URL
string siteTitle=”TestSite”;                  Site Title
string sitedes=”Site for testing”;            Site Description
int lcid=1033;                                     Local identifier – 1033 for English(US)
string siteTemp=”STS#0″;     Site Template “STS#0”-Team Site, “STS#1”-Blank

SiteSPAdminService.Admin adminService=new SPAdminService.Admin();
Authentication for default users crenntly logged in OS
adminService.Credentials = CredentialCache.DefaultCredentials;

Assigning authentication by code.  
adminService.Credentials=new NetworkCredential(“UserName”,”Password”,”Domain”);
adminService.CreateSite(siteURL, siteTitle , sitedes , lcid, siteTemp, “domainUserName”, “Display_UserName”, “email”, “”, “”);
catch(Exception ex)