Tuesday, September 18, 2007

Feature Removal from Site Template

This may be useful. I came up with an interesting way to force users to use our templates and prevent use of the out-of the box versions. By removing the "feature" from the site template manifest we can prevent something from showing up on the Create page. We start by hacking the manifest out of the stp file (when we are done, we re-save the stp [cab] file).

< id="00bfea71-7e6d-4186-9ba8-c047ac750105">
< id="00bfea71-de22-43b2-a848-c05709900100">
< id="00bfea71-e717-4e80-aa17-d0c71b360101">

Remove whatever features you like. You can see which are which from a Create page within a site.

In my site, Document Library was removed. This will also remove any customized document library list templates (which I didn't want to happen). But we can get those back with a URL like this on a page:

< href="_layouts/new.aspx?NewPageFilename=CaseLinkDocLib%2Estp&FeatureId={00bfea71-e717-4e80-aa17-d0c71b360101}&ListTemplate=101">New Document Library < /a >

That's generic and will work in any site.

It's a simple enough hack. Is there a better way?

Post Script:
When you RE-save a template, you have to re-apply this hack - all the features go back to the defaults for the site collection.

No comments:

Post a Comment