Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

how to unhide a hidden site column using Powershell

$
0
0

Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$SiteURL ="http://srvr1:123/sites/cth"

$objSite = Get-SPSite $SiteURL -ErrorAction Stop

$mRootweb=  $objSite.Rootweb

$field = $mRootweb.Fields.GetFieldByInternalName("BU")

Write-Host $field.StaticName

#pause

$type = $field.GetType()
$mi = $type.GetMethod("SetFieldBoolValue",
    [System.Reflection.BindingFlags]$([System.Reflection.BindingFlags]::NonPublic -bor   [System.Reflection.BindingFlags]::Instance))
$mi.Invoke($field, @("CanToggleHidden",$true))
$field.Hidden=$false

Write-Host $field.Hidden "..is the current status befor calling update.."

$field.Update()

$mRootweb.Update()

Write-Host $field.Hidden "..is the current status afterc alling update....."

Write-Host "unhiding the column is done successfully"

i tried the above code for unhiding a  site column, but it didnt work.Is there any way i can unhide already hidden  site column?

help is appreciated!

 

   

Viewing all articles
Browse latest Browse all 13778

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>