This blog explains the steps involving in creating a Sharepoint sub site from a custom template by calling Sharepoint web service from .Net code.

 

Sharepoint Meeting Webservice has  a method named CreateWorkspace that allows creation of sub site on the specified Sharepoint server . The URL for meeting webservice is http:///_vti_bin/Meetings.asmx where  can even be a sub site location. The syntax for the Createworkspace method is

CreateWorkspace(title, templateName, lcid, timeZoneInformation)
 
Title is the title for the new sub site that will be created.
 
TemplateName is the name of the template based on which the
new sub site will be created.
 
LCID is the locale identifier
 
timeZoneInformation is the time zone information for the new sub site.
 

All the arguments mentioned above are pretty straight forward except for template name. For creating sub sites based on the default Sharepoint templates we need to pass the template id such as “MPS#”.Whereas for creating based on custom templates we need to pass the template file name as the argument such as “Mytemplate.stp”

 

To have a preview of the built in site templates click here. To find out the templates ids click .

Typical code for creating sub site custom template is shown below

 

Samples.SP.TimeZoneInf tz = new Samples.SP.TimeZoneInf();
SP.Meetings meetings = new SP.Meetings();
meetings.Url = "http://sitename/_vti_bin/meetings.asmx";
meetings.Credentials = new System.Net.NetworkCredential("user name", "password", "domain");
meetings.CreateWorkspace("Site title", "Mytemplate.stp", 1033,tz);