In my previous post you can have a quick look on WSS Out Of Box web services – Part 1
In this post once again I want to update few WSS web service handy programs with minimum lines of code.
Before executing the code first of all add web reference http://servername:port/_vti_bin/Webs.asmx
In this example I have given the web reference folder name as myWebswebservice
Show all subsites:
[sourcecode language=”csharp”] static void Main(string[] args)
{
myWebswebservice.Webs allWebs = new myWebswebservice.Webs();
//credentials for password based authentication
//System.Net.NetworkCredential mycredentials = new System.Net.NetworkCredential(“g.vijaikumar”, “mypassword”, “fivenumber”);
//allWebs.Credentials = mycredentials;
//using system credentials of the application
allWebs.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
string webTitle = null;
XmlNode myNode = allWebs.GetAllSubWebCollection();
XmlNodeList nodes = myNode.SelectNodes(“*”);
foreach (XmlNode node in nodes)
{
Console.WriteLine(webTitle + node.Attributes[“Title”].Value);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine(“Press any key to continue…..”);
Console.ReadLine();
}
[/sourcecode]
Hi Vijay,
I want to create a content type programatically through webservices.I have tried with webs.asmx(Create contentype method),But I am getting soap exception .Could you please provide me any sample code if you have…?