Sharepoint - Hide column from Edit form in SharePoint Online

With PnP PowerShell Cmdlets

Connect-PnPOnline <tenant-site-url>

$ctx = Get-PnPContext
$field = Get-PnPField -Identity <field-name> -List <list-name>

$field.SetShowInNewForm($false)
$field.Update()
$ctx.ExecuteQuery()

To check if the update took, look for ShowInNewForm="FALSE" in schema xml

$field.SchemaXml

To install PnP Powershell Cmdlets

https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps

Please note that this doesn't seem to work if either the column is set to mandatory or content types are used within that list.


You need to use SharePoint online PowerShell.

In that powershell, try below code:

$User = "[email protected]"
$SiteURL = https://tenant.sharepoint.com/sites/site #enter site collection url


#Add references to SharePoint client assemblies and authenticate to Office 365 site – required for CSOM
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)

#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds

$fieldTitle = "ColumnName"
$customfield = $Context.Site.RootWeb.Fields.GetByInternalNameOrTitle($fieldTitle) 
$customfield.ShowInEditForm($false)
$customfield.UpdateAndPushChanges($true)

$Context.ExecuteQuery()

Download & install the SharePoint client component SDK which will give you the CSOM dlls.

Also download the SP online management shell to run the above code.

SharePoint 2013 Client component SDK

SharePoint online management shell