Categories
SharePoint WSS

Determine the site template used to create SharePoint sites

I was facing an issue where two site which were look alike but behaved differently, the navigation and bread crumbs were laid differently. We have a standard process to using pre defined templates and as per the request for site creation both the site were suppose to have Team Site template and I guess they were created as per the process defined.

When users had issue they asked to introspect on what going with these site. The first thing I wanted to know indeed was templates used to create the sites. I poked around the site settings pages but could not find any information on which page template was used. I then turned to central admin but in vain. I quickly posted to the MSDN forums, I was sure someone would have already gone through this and there would a way or code which existed.

As per my expectation I got a reply which pointed me to this page on Rafelo’s blog. All credits to Rafelo for such short code. See the code and instructions below

<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Import Namespace="Microsoft.SharePoint" %>

<script runat="server">
protected override void OnLoad(EventArgs e){
SPSecurity.RunWithElevatedPrivileges(delegate()
{
  SPWeb thisWeb = this.Web;
  lblWebTempalte.Text = thisWeb.WebTemplate;
  lblWebTemplateID.Text = thisWeb.WebTemplateId.ToString();
});
}
</script>
<asp:Content ID="Main" runat="server" contentplaceholderid="PlaceHolderMain" >
<p>
Web Template: <asp:Label ID="lblWebTempalte" runat="server" />
</p>
Web Template ID: <asp:Label ID="lblWebTemplateID" runat="server" />
</asp:Content>

<asp:Content ID="PageTitle" runat="server" contentplaceholderid="PlaceHolderPageTitle" >
Site Template Information
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" runat="server" contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
Site Template Information
</asp:Content>

Save the page to your layouts folder (usually c:\program files\common files\microsoft shared\web server extensions\12\template\layouts\). Once the page has been saved, you can access it from any of your SharePoint sites via http://yoursharepointsiteaddress/_layouts/pagename.aspx

By Sameer Dhoot

Welcome to my blog. I am IT Professional with 10 years of experience across several IT disciplines. I am currently based in Farmington Hills, Michigan, USA. I hope that you find my blog of interest. It is mostly around Microsoft platform including SharePoint, SQL Server, TFS, Windows OS, Virtualization as this is what I am currently working on, but my aim is to write about all of the competencies described in my profile and write contents which I believe can be helpful to broader audience (IT Pros) and may include general computing advice, how-to's, FAQ, Tips and Tricks. I would welcome contributors and critics who would help to build this blog in terms of better contents and usability.

4 replies on “Determine the site template used to create SharePoint sites”

I really like your blog.. very nice colors & theme. Did you make this website
yourself or did you hire someone to do it for you?
Plz respond as I’m looking to design my own blog and would like to find out where u got this from. thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.