I just recently responded to a post in one the MSDN SharePoint forums where a user was asking how he could determine what templates where being used by his sites. I didn’t really feel like having him look at the database, so I wrote a simple application page that exposes the WebTemplate and WebTemplateID properties of the SPWeb object. Here is what the code looks like:

protected override void OnLoad(EventArgs e){
  SPWeb thisWeb = this.Web;

  lblWebTempalte.Text = thisWeb.WebTemplate;
  lblWebTemplateID.Text = thisWeb.WebTemplateId.ToString();

Web Template:

Web Template ID:

Site Template Information

Site Template Information

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

Updated 8/26/2008: Updated code to remove “using” statement when getting a reference to the SPWeb object. Disposing of a shared resource such as an SPWeb object obtained from the current context may cause the SharePoint object model to behave unpredictably. Instead we should let SharePoint manage the object. See Best Practices: Using Disposable Windows SharePoint Services Objects for more information.

Technorati Tags: , ,