How to get all the Site Templates from the SharePoint Site


using
System;
using
System.Linq;
using
System.Text;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.Client;
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 templateColl = web.GetAvailableWebTemplates(1033);
foreach (SPWebTemplate template in templateColl)
{
Console.WriteLine(template.Name + " - " + template.Title+" : "+ template.Description);
}
Console.ReadLine();
}
}
}
}
}
Ebook Download
View all
Learn
View all