SharePoint 2013 PowerShell Script Hide a Column Yes/No type in a Site Content Type

In this SharePoint PowerShell tutorial, we will discuss how we can hide Yes/No column type from a Site content type in SharePoint 2013 using PowerShell.

New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

I got an Requirement that to hide a Yes/No Field in a Custom list called “ABC”. But after analysis came to know that field is coming from the content type called “XYZ”. So my first approach is from Visual Studio and made a code change to that field and added a property called “hidden= true”. But that field property is not reflecting in the SharePoint list not even in Content type as well, from other blogs and colleague suggestions came to know that you cannot hide an existing field of type “yes/no” from .wsp deployment. So, found a way that using PScript we can hide the yes/no field.

Below is the PowerShell code, which you can write inside a Windows PowerShell ISE.

Add-PsSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite “Site URL”
$web = $site.RootWeb
$web.AllowUnsafeUpdates = $true
$ct = $web.ContentTypes[‘Content Type Name’]
$field = $ct.FieldLinks[” FieldInternalName “]
$field.Hidden = $true
$web.AllowUnsafeUpdates = $false
Write-Host “Field is hidden in the content type”

Once PSScript can verify in content type you can see that field has been hidden.

Read some SharePoint PowerShell tutorials:

Hope this will be helpful.

Check out Best Alternative to InfoPath -> Try Now


(Installation & Features)

About Sravan kumar

I am a SharePoint Developer Working in Reputed MNC company Bangalore.

View all posts by Sravan kumar →