Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I always struggle to find out that how to know what site definition or site template a "Web" or a "Site" is using. We do have a lot of custom site definitions and site templates, we are using in our portal, so If there is any freeware tool or way to find out, would be great.

We keep records of Site Templates in Database, but I want to know if there is any way, I find it out using a C# script or simply any app.

Cheers

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Run the following code in your C# Console Application and you'll get the listing all your sub-sites with their respective site definitions

using (SPSite ospSite = new SPSite("http://server/"))
{
    SPWebCollection webs = ospSite.AllWebs;
    foreach (SPWeb web in webs)
    {

       try
       {
          string template = web.WebTemplate;
          Console.WriteLine(web.Url.ToString() + " : " template.ToString());
       }
       finally {web.Dispose();}
    }

 }
share|improve this answer
    
Cheers brother done it, I was wondering if you have any twitter account or LinkedIn , i can follow you :) –  Muhammad Raja Jun 26 '12 at 8:31
1  
As I say it, follow me at your own risk ;) twitter.com/#!/falaky –  Falak Mahmood Jun 26 '12 at 8:34

Use SPWeb.WebTemplate property.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.