Hide “Fabulous 40” templates

The Fabulous 40 (a.k.a. Fab40 or Application Templates) are a set of 40 application templates for Windows SharePoint Services 3.0. These were installed on a lot of SharePoint 2007 environments.

When upgrading to SharePoint 2010 these templates become a challenge. The sites based on the Site Admin Templates (.STP) will be upgraded. After the upgrade these will likely work, but you can’t create any new sites based the STP templates, because SharePoint 2010 does not support STP files for site templates.

Sites which are based on the Server Admin Templates (.WSP) are more challenging because some Fab40 templates cannot be used for creating new sites in SharePoint 2010. To perform an upgrade you need to install the templates which are currently in use in the SharePoint 2007 environment.

To keep the new SharePoint 2010 environment as clean as possible you want to disable the creation of new sites based on the Fab40. You could choose to update the XML files on the file system (webtemp files in 14-hive), but the downside of this is you need to update all servers in the farm and when a new server is added this needs to be adjusted manually.

So I started looking into the order SharePoint reads the webtemp files when the application pool process (W3WP.exe) spins up on initial load. I used Process Monitor to research the file access in the “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\XML\” folder. Based on the order shown in the screenshot below, it seems the “webtemp???.xml” files are loaded on alphabetical order. 

Process Monitor - Capturing the W3WP.exe process

Meaning if I would place a webtemp XML file which filename starts with “webtempaaa” it would load first and equally the filename “webtempzzz” would load at the end. Since underscores “_” are often used I wanted to check that particular filename as well. It seems a filename “webtemp_” is loaded at the end, instead of at the start (what I assumed).

The next question is: “Does SharePoint keep the settings which it reads in the first files or do these settings get overridden by settings in files loaded afterwards?”. The answer to this is it only stores the settings which it reads first. Meaning if I want to hide the templates I need to add a webtemp file with the name “webtempaaaHideFab40.xml”. Within the file I need to hide all the Fabulous 40 Server Admin Templates.

The XML file below shows the contents of the “webtempaaaHideFab40.xml” file:

<?xml version="1.0" encoding="utf-8" ?> <!-- Hides all Fabulous 40 templates, filename needs to begin with "webtempaaa..." to be loaded as the first one --> <Templates xmlns:ows="Microsoft SharePoint"> <Template Name="absence" ID="75811" SetupPath="SiteTemplates\absence" > <Configuration ID="0" Title="Absence and Vacation Schedule " Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="projmulti" ID="75819" SetupPath="SiteTemplates\projmulti" > <Configuration ID="0" Title="Budgeting and Tracking Multiple Projects" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="BT" ID="75801"> <Configuration ID="0" Title="Bug Database" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="callcenter" ID="75812" SetupPath="SiteTemplates\callcenter" > <Configuration ID="0" Title="Call Center" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="projchange" ID="75818" SetupPath="SiteTemplates\projchange" > <Configuration ID="0" Title="Change Request Management" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="comproc" ID="75813" SetupPath="SiteTemplates\compproc" > <Configuration ID="0" Title="Compliance Process Support Site" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="CM" ID="75802"> <Configuration ID="0" Title="Contacts Management" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="DR" ID="75803"> <Configuration ID="0" Title="Document Library and Review" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="eventplan" ID="75814" SetupPath="SiteTemplates\eventplan" > <Configuration ID="0" Title="Event Planning" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="exreports" ID="75815" SetupPath="SiteTemplates\exreport" > <Configuration ID="0" Title="Expense Reimbursement and Approval Site" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="helpdesk" ID="75816" SetupPath="SiteTemplates\helpdesk" > <Configuration ID="0" Title="Help Desk" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="IT" ID="75804"> <Configuration ID="0" Title="Inventory Tracking" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="itteam" ID="75817" SetupPath="SiteTemplates\itteam" > <Configuration ID="0" Title="IT Team Workspace" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="JRIM" ID="75805"> <Configuration ID="0" Title="Job Requisition and Interview Management" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="KB" ID="75806"> <Configuration ID="0" Title="Knowledge Base" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="LL" ID="75807"> <Configuration ID="0" Title="Lending Library" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="PATM" ID="75808"> <Configuration ID="0" Title="Physical Asset Tracking and Management" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="projsing" ID="75820" SetupPath="SiteTemplates\projsing" > <Configuration ID="0" Title="Project Tracking Workspace" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="RER" ID="75809"> <Configuration ID="0" Title="Room and Equipment Reservations" Hidden="True" DisplayCategory="Application Templates" /> </Template> <Template Name="ST" ID="75810"> <Configuration ID="0" Title="Sales Lead Pipeline" Hidden="True" DisplayCategory="Application Templates" /> </Template> </Templates>

Advertisements

Wait for WSP solution to deploy

Trying to install a WSP solution via scripting and wanting to wait for the solution to be installed? This is a common scenario I’m facing quite a lot. Every time trying to find the script again, made me decide to blog about it.

This PowerShell script checks if the solution exists in the Solution Store and waits for it to finish its deployment job.

function WaitForSolutionToFinish([string]$SolutionFileName) { $solution = Get-SPSolution $SolutionFileName if ($solution -eq $null) { Write-Host " -solution '$SolutionFileName' not found in solution store" } if (!$solution.JobExists) { Write-Host " -there are no solution jobs waiting" } else { Write-Host -NoNewLine "Waiting for solution job" $now = Get-Date $timeout = (Get-Date).AddMinutes(5) while ($solution.JobExists -and $now -le $timeout) { Write-Host -NoNewLine "." Start-Sleep -s 3 } if (!$solution.JobExists) { Write-Host " finished!" } else { Write-Error "Waiting for solution job timed out! Check the Admin Timer Job status and ULS logs" } } }