0

So a client recently experienced this issue when they were trying to use a site template they had created. Upon investigation it turns out that a content type in the content type hub had a few null values. I confirmed this by unpacking the wsp and checking the ElementsFields.xml and noted that there were a few values set to ''. I found this nifty little script online @ http://sharepointfeaturesandfailures.blogspot.com/2013/09/fixing-missing-hidden-and-sealed.html. I ran the script on the content type hub URL so that it could replicate across all sites where it was having the issue. We then recreated the site template and bam all was good!

$site = Get-SPSite "site collection url goes hurr"
 $Web =$site.RootWeb

 for($i = $Web.Fields.count -1; $i -ge 0; $i--)
 {
 $field = $Web.fields[$i]
 [XML]$schema = $field.schemaxml 
 if ( $schema.InnerXML.Contains("Hidden=""""")){
 $schema.field.Hidden = "FALSE"
 $field.schemaxml = $schema.Innerxml
 Write-Host $field "HIDDEN: " $schema.field.Hidden 
 $field.update()
 } 
 if ( $schema.InnerXML.Contains("Sealed=""""")){
 Write-Host $field "Sealed: " $schema.field.Sealed 
 $field.Sealed = "FALSE"
 $field.update()
 }
 if ( $schema.InnerXML.Contains("Required=""""")){
 Write-Host $field "Required: " $schema.field.Sealed 
 $field.Required = "FALSE"
 $field.update()
 }
 }


0 comments: