sharepointstsadm

SharePoint - find the sitetemplate value of a WSP template?


I'm trying to script the creation of sites for the fab 40 Microsoft SharePoint templates. I'm having trouble finding the value for the sitetemplate parameter for the stsadm command to create the sites.

e.g.:

stsadm -o createsite -url http://Test/sites/Team_Site **-sitetemplate STS#0** -title "Team Site" ...

Is there a command I can run, or somewhere I can look to find the sitetemplate value for WSP packages (e.g. BugDatabase.wsp)?


Solution

  • I think the easiest way to do this is via PowerShell, but you can write code to do the same thing. The key is to get a reference to the web and then call SPWeb.GetAvailableWebTemplates(lcid).

    Here's a few lines of PowerShell script/command to spit the Name and Title properties out on the screen:

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")  
    $theSiteColl = New-Object Microsoft.SharePoint.SPSite("http://server")  
    $theWeb = $theSiteColl.OpenWeb()  
    $theWeb.GetAvailableWebTemplates(1033) | select name, title  
    #put your locale ID in the function call  
    

    The Name column is the one you have to pass into the stsadm -o createsite command, and the Title column helps associate it with something that makes sense. On my test box, the BugDatabase application template is BT#0.