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.
$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 executed.you can verify in content type you can see that field has been hidden.
Read some SharePoint PowerShell tutorials:
- Hide Document Library or Lists using PowerShell in SharePoint 2016 or SharePoint 2013
- Increase SharePoint Online Storage Quota using PowerShell
- E-mail notification using PowerShell script in Office 365
- GridView in PowerShell in SharePoint
- Show hidden features in SharePoint 2013 using PowerShell
- List all users and Group names in SharePoint 2013 and SharePoint 2016 using PowerShell
Hope this will be helpful.
FREE SHAREPOINT 2019 PDF
(Installation & Features)