using System;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace SiteTemplates
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://serverName:1111/sites/SPSiteDataQuery/"))
{
using (SPWeb web = site.RootWeb)
{
SPWebTemplateCollection templateCollection = site.GetWebTemplates(site.RootWeb.RegionalSettings.LocaleId);
string templateName = web.WebTemplate + "#" + web.Configuration;
foreach (SPWebTemplate webTemplate in templateCollection)
{
if (webTemplate.Name.Equals(templateName))
{
Console.WriteLine("\"{0}\",\"{1}\"",webTemplate.Title, templateName);
}
}
Console.ReadLine();
}
}
}
}
}
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Anitha KalidasanPosted Jan 22, 2014, 5:18 AM
Hi Vijay, Useful information. Its working fine with SP2013. Is their any way to get the web template id and name of the current site?