4

I`m trying to analyse sharepoint site.

In SPSite Level, I want to get Site template name,

and In SPWeb Level, I also want to get web template name.

But I am a newbie in SharePoint, I`m not sure how can I find those things.....

Please somebody help me, explain about it or give some link about it

Thank you.

0

1 Answer 1

4

SPWeb.WebTemplate property Gets the name of the site definition or site template that was used to create the site.

using System;
using Microsoft.SharePoint;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite site = new SPSite("http://localhost"))
         {
            using (SPWeb web = site.OpenWeb("sites/blog"))
            {
               Console.WriteLine("Site definition: {0}", web.WebTemplate); // BLOG
               Console.WriteLine("Web template ID: {0}", web.WebTemplateId); // 9

               Console.WriteLine(web.WebTemplate == SPWebTemplate.WebTemplateBLOG); // True
               Console.WriteLine(web.WebTemplateId == (int)SPWebTemplate.WebTemplate.Blog); // True
            }
         }
         Console.ReadLine();
      }
   }
}

For powerShell check this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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