Friday, August 20, 2010

Know the site template used for the SharePoint site

Hello all, Hope all are doing fine. I believe this is very rarely needed post that we need to know what site template [Publishing site, workspace, meeting workspace, team portal etc..] was used for a particular SharePoint site. From the UI [means by navigating to SharePoint site through browser] we can't identify this. So, we need to follow either of the steps given below to identify the template used for a specific site.
  1. First option is, this is my recommended choice and very easy too. By using SharePoint Manager tool [available for both 2010 and 2007.] Download it for free from Codeplex and install it. Now, open the SharePoint Manager and connect to the SharePoint site collection. When you click on a specific SharePoint site, on the right side it will show you all the properties available in the SP object model for that site. In it find for TemplateID and check the value showing there. That's it. What is TemplateID and how to know template name from it? Navigate to end of this post for TemplateID to Name mapping.
  2. Second option is, if there is no way to install SharePoint manager or if any other problems, then save the current site as site template[.STP extension]. Now, save it to disk somewhere. Now, navigate to that location and rename the file to .CAB extension. Extract the CAB file and find the manifest.xml file. Now, in the file check for the TemplateID string and get the value. Navigate to end of this post for the TemplateID to Name mapping.
  3. From the SP Object Model: Through managed code we can identify this very easily with below code.
    using (SPWeb web = site.OpenWeb("/"))
    {   
       string templateID = web.WebTemplateId.ToString();
    } 
  4. Using STSADM.EXE: It needs high level permissions. Means the user should be an administrator on the server. Below is the command we need to use for knowing the site template.
    stsadm.exe -o enumallwebs -database [content database name]
  5. From Sql Server: Sql server has all the information about SharePoint. So, if you have access to database then login to the sql server management studio and execute below query on the content database of the application.
    SELECT Title, WebTemplate FROM dbo.Webs WHERE Title='Test Publishing Site'
Choose one option which is useful or easy for you and identify the correct template.

Site template ID to Name mapping:
0 - GLOBAL (SetupPath=global) - "Global template"
1 - STS - "windows SharePoint Services Site", "Team Site", "Blank Site", "Document Workspace"
2 - MPS - "Basic Meeting Workspace", "Blank Meeting Workspace", "Decision Meeting Workspace", "Social Meeting Workspace", "Multipage Meeting Workspace"
3 - CENTRALADMIN - "Central Admin Site"
4 - WIKI - "Wiki Site"
7 - BDR - "Document Center"
9 - BLOG - "Blog"
20 - SPS (OBSOLETE) - "SharePoint Portal Server Site"
21 - SPSPERS - "SharePoint Portal Server Personal Space"
22 - SPSMSITE - "Personalization Site"
30 - SPSTOC (OBSOLETE) - "Contents area Template"
31 - SPSTOPIC (OBSOLETE) - "Topic area template"
32 - SPSNEWS (OBSOLETE) - "News area template"
33 - SPSNHOME (SubWebOnly) - "News Home template"
34 - SPSSITES - "Site Directory area template"
36 - SPSCOMMU (OBSOLETE) - "Community area template"
38 - SPSREPORTCENTER - "Report Center Site"
39 - CMSPUBLISHING (SetupPath=SiteTemplates\PUBLISHING) - "Publishing and Team Collaboration Site"
40 - OSRV (SetupPath=SiteTemplates\OSRV) - "Shared Services Administration Site"
47 - SPSPORTAL - "Corporate Intranet Site"
50 - SRCHCEN - "Search Center"
51 - PROFILES - "Profiles"
52 - BLANKINTERNETCONTAINER - "Internet Presence Web Site"
53 - BLANKINTERNET - "Publishing Site", "Press Releases Site", "Publishing Site"
54 - SPSMSITEHOST - "My Site Host"
90 - SRCHCENTERLITE (SetupPath=SiteTemplates\SRCHCENTERLITE) - "Search Center Lite"
6221 - PWA (SetupPath=SiteTemplates\PWA) - "Project Web Access Site"
6215 - PWS (SetupPath=SiteTemplates\PWS) - "Project Workspace"
14483 - OFFILE - "Records Repository", "Records Repository"

Hope you like this post and will write more these kind of posts. We know plenty of things but some of the things are very hard to find. I will post all those kind in my blog. Keep checking the blog.

17 comments:

  1. Good one. Helps me find some properties of the site.

    ReplyDelete
  2. You might like to add that the FAST Search Center is ID 2000 in SP2010.

    ReplyDelete
  3. If you use SharePoint 2010 and have administrative access to the sharepoint server, you can also start the SharePoint Management Console (Powershell) and type the following commandlet

    Get-SPWeb -Identity | format-list

    Make sure you replace with the full url of the web you would like to list, e.g. https://mysite.com/myweb

    Look for the properties WebTemplateName and Configuration. For a teamsite, for example, the WebTemplateName will be STS and the Configuration 0. (Config 0 is a teamsite, Config 1 is a blank site, Config 2 is a document workspace, etc.)

    ReplyDelete
  4. In the 4th point above mentioned is

    stsadm.exe -o enumallwebs -databasename [content database name]

    it is written as

    stsadm.exe -o enumallwebs -database [content database name

    ReplyDelete
  5. This is some great information. However it is not possible to know if the original site template was blank or teamsite. It looks like Metalogix are able to make the difference. See the screen shot: http://www.softpedia.com/progScreenshots/Metalogix-SharePoint-Site-Migration-Manager-Screenshot-125867.html
    Do you have an idea how they could figure it out?

    ReplyDelete
  6. Hi, this was some great information. All of the options listed together. Didn't have to look anywhere else.. Thanks. Keep up the good work.

    ReplyDelete
  7. Thanks ! I found exactly what I was looking for.

    ReplyDelete
  8. Thanks ! I found exactly what I was looking for.

    ReplyDelete
  9. Nice and helpful post. Thanks!

    To get the list of globally installed templates, we can also use the "get-spwebtemplate" powershell cmdlet.

    ReplyDelete
  10. I'm trying to distinguish in search results certain sites that were create using a custom template. Do you think it's possible?

    ReplyDelete
  11. #5 should also output ProvisionConfig, then we'll be able to identify whether it's Blank or Team site or Document workspace.

    Great article! Thank you!

    ReplyDelete
  12. Another simple method to get the site template of a site is to simply append: _vti_bin/owssvr.dll?Cmd=GetProjSchema
    to the url and get the current ONET xml schema that is applied to that site. THe "Project Title=" field gives the name of the site template used.

    ReplyDelete
    Replies
    1. Oh my goodness, SO much easier!! Thanks!!

      Delete
  13. Or just go to any page and view source. Find "var g_wsaSiteTemplateId" and that is set to a value that maps to the type of template used.

    Credit: http://nickhobbs.wordpress.com/2013/05/18/sharepoint-how-to-check-which-site-template-was-used-to-create-a-site-just-using-a-web-browser/

    ReplyDelete
  14. This was all very interesting (and overwhelming) and I was wondering if soemthing similar was available to find what template a DOCUMENT LIBRARY was created from?
    I am trying to find out if the library in question was created from the standard template or a customised template.

    Any help would be appreciated.

    Thank you

    ReplyDelete