A quick look on WSS Out Of Box web services

Here I am going to show you how to create/delete site collection and create/delete list using WSS OOB webservices

Creating site collection

static void Main(string[] args)
{

AdminService.Admin admService = new AdminService.Admin();
admService.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
admService.CreateSite("http://fivenumber:5/sites/someothername", "SomeotherTitle", "SomeotherDescription", 1033, "STS#0", "Fivenumber\\g.vijaikumar", "GVijaiKumar", "g.vijaikumar@fivenumber.com", "", "");
Console.WriteLine("Site Collection Created:");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
Console.WriteLine(ex);
}

Console.WriteLine("Press any key to continue.....");
Console.ReadLine();
}

Deleting site collection

static void Main(string[] args)
{

AdminService.Admin admService = new AdminService.Admin();
admService.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
admService.DeleteSite("http://fivenumber:5/sites/someothername");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

Creating List

static void Main(string[] args)
{

List50.Lists listService = new List50.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
XmlNode ndList = listService.AddList("List_Name", "List_Description", 100);
Console.WriteLine("List Created:");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

Deleting List

static void Main(string[] args)
{

List50.Lists listService = new List50.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
listService.DeleteList("List_Name");//, "List_Description", 100);
Console.WriteLine("List Deleted:");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

Published by

G Vijai Kumar

Passion towards Microsoft Technologies, Specialized in MOSS