I was intrigued by Phil Wicklund‘s post on removing custom columns from wiki pages until I saw that his solution requires modifying the underlying template file (DocumentTemplates\wkpstd.aspx) and will affect every wiki on the farm. Fortunately, the control he suggests deleting (ListFieldIterator) respects fields’ ShowInDisplayForm property, which can be set in a number of ways:
- Feature: Attribute of Field or FieldRef elements in a site column, content type or list template
- Feature receiver:
var web = properties.Feature.Parent as SPWeb;
var field = web.Lists["MyWiki"].Fields["HideMe"];
field.ShowInDisplayForm = false;
field.Update(); - PowerShell:
$web = Get-SPWeb $url
$f = $web.Lists['MyWiki'].Fields['HideMe']
$f.ShowInDisplayForm = $false
$f.Update()
$web.Site.Dispose()
- Sharad Kumar‘s Form Settings editor (CodePlex)
Any of these should be preferred to modifying the hive and breaking supportability.
January 6, 2009 at 9:52 am
Nice tip! I didn’t know that property existed… but now that I do, I can think of a ton of great reasons to use it.
Phil