문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top