Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

How to Hide Site Templates in SharePoint with PowerShell

$
0
0
How to hide a site template in SharePoint ? Editing "webtemp.xml" file is one option to hide site templates in SharePoint 2007 as per my another article: Hide Site templates & List Templates in SharePoint

However, There is an another way to hide site templates in SharePoint 2010: Using PowerShell! Update "WebTemplates" property of SPWeb object. Say for E.g. The below script sets available web templates to "Team sites" and "Blog". All others will be removed!

$Web = Get-SPWeb "http://sharepoint.crescent.com/teams/"

$Web.AllProperties["__WebTemplates"] = "<webtemplates><lcid id=""all""><webtemplate name=""STS#0"" /><webtemplate name=""BLOG#0"" /></lcid></webtemplates>"

#To Reset to Default, Use: $Web.AllowAllWebTemplates()

$Web.Update()
Just supply the site template ids to the above code to make it available. You can hide custom site templates as well. To get all available site templates, use: Get-SPWebTemplate SharePoint Site Template IDs Reference

Here is the Before and After screens:
hide site templates sharepoint 2010
After Executing the Script:
hide site template sharepoint
Hiding SharePoint site template can be achieved using C# Object model also. Manipulate SPWebTemplateCollection of SPWeb object and update it to to hide a site template in sharepoint 2010 or in SharePoint 2007.
http://www.sharemuch.com/2010/11/30/hiding-sharepoint-2010-web-templates-programmatically/

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>