Fixing permmask field

Issue:

=====

Edit item options are missing in the ribbon and in the drop down of the items in a list

 

Cause:

=====

Issue is due to PermMask field schema has missing "RenderXMLUsingPattern", it can be at the site level, web level or list level

 

Resolution:

=====

Run the following script, it run through all the webs, including rootweb and lists and fixes the schema

===========================

$site = get-spsite <URL of the site collection>

function checkxml($field)

{

  if($field.SchemaXml.Contains("RenderXMLUsingPattern"))
{

return $TRUE
}
else
{
return $FALSE
}

}

function fixxml($field)

{

   [xml]$schema = $field.SchemaXml

   $att = $schema.createattribute("RenderXMLUsingPattern")

   $att.value = "TRUE"

   $schema.field.attributes.append($att)

   $field.schemaxml = $schema.innerxml

   $field.update()

}

$web = $site.RootWeb

if(checkxml($web.Fields.GetFieldByInternalName("PermMask")))

{

  write-host "Field at Root Level is fine" 
  
}

else

{

  fixxml($web.Fields.GetFieldByInternalName("PermMask"))
  $web.update()
  
}  
      

foreach ($webs in $site.AllWebs)

{

try { $fieldw = $webs.fields.getfieldbyinternalname("PermMask") }
catch [System.Exception] { write-host "Field not found in :" $webs.url }

  if(checkxml($fieldw))

{

write-host "No broken field found at :" $web.url

}

else
{

write-host "Broken Field found at :" $web.url
fixxml($fieldw)
$web.update()

}

for($i = $webs.lists.count - 1; $i -ge 0; $i--)
{
$list = $webs.lists[$i]
try{ $fieldl = $list.fields.getfieldbyinternalname("PermMask") }
catch [System.Exception] { write-host "Permmask field not found in :" $list.title }

if(checkxml($fieldl))

{

write-host "No broken field found at :" $list.title

}

else
{

write-host "Broken Field found at :" $list.title
fixxml($fieldl)

}

}

}

Comments

  • Anonymous
    January 01, 2003
    Fixing permmask field
    thank you
  • Anonymous
    September 27, 2016
    WOW! Thank you maaaan.