0

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

2

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();}
    }

 }
  • 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
1

Use SPWeb.WebTemplate property.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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