ShareMyPoint ORDINARY KNOWLEDGE : VIVID THOUGHTS

13Nov/084

Determine the site template used to create SharePoint sites

Posted by Sameer Dhoot under SharePoint, WSS

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

Comments (4) Trackbacks (0)
  1. Nice one helped us a lot to determine site template.

  2. Worked fine for Sharepoint 2010 too.

  3. I can confirm that this page returns the Template used in SharePoint 2010.
    Thank you very much!

  4. 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 comment



No trackbacks yet.