SharePoint Tip #41. Do you know “how to find the site definition being used for a site”?!

Sometimes you have a already created site but wanted to know the site definition of that site, or gets the name of the site definition from which the site template that was used to create the site is derived. There are several steps to get that template

  1. Navigate to the “Central Administration –> Application Management –> Site Collection List” and choose the site you are trying to find the template for
  2. Write down site “Title” and “Database name” values
  3. Open SQL management studio and execute the following query for content database that you find from previous step
       1: SELECT Title, WebTemplate,ProvisionConfig
       2: FROM dbo.Webs
       3: WHERE Title = ''<title of your site>''
  4. Write down the number in “Web Template” column
  5. Navigate to this site http://blumenthalit.net/blog/Lists/Posts/Post.aspx?ID=45 and find definition is associated with that ID

That’s all.

The second way to get it is via SharePoint API SPWeb.WebTemplate property. Sample is there

Tips & Tricks section moved to its own site. http://sharepoint.devs-sandbox.com/index.php?/Tips-and-Tricks/Development/tip-41-how-to-find-the-site-definition-being-used-for-a-site.html

6 Comments »

  1. Robert Bogue Said,

    June 14, 2009@ 1:25 pm      Reply

    The API was is the way that this should be done… STAY OUT OF THE DATABASES

    Also, this isn”t the template – it”s the site definition.

  2. laflour Said,

    June 14, 2009@ 1:43 pm      Reply

    Yep, right, the site definition from which the site template that was used to create the site is derived!
    Thanks for noticing.

    Btw, you might not have PowerShell installed to get site definition via API.
    Database is the way to peek on that value

  3. Joshua Said,

    June 14, 2009@ 9:21 pm      Reply

    There is another since SP2. Using stsadm -o enumallwebs. This will show the site definition and can be a great one to check all sites.

    Good work on the tops by the way.

  4. E. Shupps Said,

    June 16, 2009@ 3:28 am      Reply

    Michael,

    First, you really need to do more research before posting this kind of information. Microsoft explicitly states that reading directly from the database is unsupported. The recognized best practice, as Rob stated in the first comment, is to STAY OUT OF THE DATABASE. People are going to assume that your advice is valid because you don”t include any sort of disclaimer, as in “if you absolutely have no other option you can do this but you should be aware that it is unsupported, could potentially damage your SharePoint installation, and could lead to a lack of support from Microsoft” or something to that effect. This advice is dangerous, to say the least; please be more responsible in the future.

  5. Gabriele del Giovine Said,

    July 10, 2009@ 9:16 pm      Reply

    The Sharepoint DB did not exits.
    If you see a Sharepoint DB, forget about: isn”t real 🙂
    The Sharepoint DB exist only in the DBA universe!

  6. Jason Said,

    October 2, 2009@ 12:16 pm      Reply

    Some of the comments on looking into the database are a bit harsh! Yes, it might be un-supported, but if you can”t understand a simple select statement then maybe you shouldn”t be using SharePoint altogether?

    Michael, thanks for the tip – I”d recently wondered how you could find this information and now I know! I don”t have SP2 installed either to enumallwebs, so this helps me a lot.

    Btw – there are 3 values for publishing site – so you don”t necessarily know which one exactly has been used.


RSS feed for comments on this post · TrackBack URI

Leave a Comment