I need to change a root site's Item Content Type settings back to the default values. I also need to do this for all other Content Types that inherit from Item. Can someone recommend a safe an efficient method to do this? It’s important that we restore the Site Content Type definitions only; we don’t want to lose any customizations.
Background:
Someone went into the root level of a SharePoint 2010 site and changed the Column settings for the Item Content Type's Title field by making it Hidden instead of Required. When they did this they updated all content types that inherit from Item. This was done via root/_layouts/ManageContentTypeField.aspx under: Site Settings > Site Content Types > Item > Change Content Type Column
After problems arose, another person went and changed it back to Required (also updating all inherited Content Types). This was not the correct solution because some of the descendant Content Types have different defaults. For example: the Document Content Type's Title Field is Optional by default.
Aside from manually going through everything listed on /_layouts/mngctype.aspx what's an efficient and safe way to restore the default values of the 'built in' Site Content Types?
Many thanks!
-- 2/8 Update --
UPDATE:
Haven't had time to deal with this yet but I wanted to thank everyone for their responses. A coworker wrote a powershell script for me that iterates all content types and outputs the Title field's settings for each. Pretty sure I can modify it to re-set the defaults (after comparing the script's output from a fresh SP install). In case it may help anyone, here's the script in it's current form:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = new-object Microsoft.SharePoint.SPSite(“http://site:port”);
$myContentTypes = $site.rootweb.contenttypes | ForEach-Object {
$myContentType = $_
$myFields = $myContentType.Fields | ForEach-Object {
$myField = $_
if ($myField.Title -eq "Title") {
write-host $myContentType.Name'|'$myField.Hidden'|'$myField.Required
}
}
}
#>
$site = new-object Microsoft.SharePoint.SPSite(“http://site”);
$path = "c:\path\outputFile.csv"
$csv = Import-csv -path $path
foreach($line in $csv)
{
$myContentType = $site.rootweb.contenttypes[$line.ContentType.trim()]
$myTitleField = $myContentType.Fields["Title"]
if ($myTitleField.Hidden.ToString().trim().ToUpper() -ne $line.HiddenAtt.trim().ToUpper() -or $myTitleField.Required.ToString().trim().ToUpper() -ne $line.RequiredAtt.trim().ToUpper())
{
if($line.HiddenAtt.trim().ToUpper() -eq "TRUE")
{
write-host $myContentType.Name: Title field is HIDDEN
}
else
{
if($line.RequiredAtt.trim().ToUpper() -eq "TRUE")
{
write-host $myContentType.Name: Title field is REQUIRED
}
else
{
write-host $myContentType.Name: Title field is OPTIONAL
}
}
}
}
