There is already an answer for doing this with a field name that is unique among lists in a site but I have a field name that is not unique ("Comments") and am trying to figure out how to make the solution linked below specific for a certain SharePoint list.

Hide column from Edit form in SharePoint Online

1 Answer 1


Here is sample script for your reference.

Add-Type -Path (Resolve-Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll")
Add-Type -Path (Resolve-Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll")

Function Get-SPOContext([string]$Url,[string]$UserName,$Password)
    write-host Get-SPOContext   
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
    $Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $Password) #SecurePassword
    return $Context

$UserName = "[email protected]"
$Password = Read-Host -Prompt "Enter password" -AsSecureString    
$Url = "https://xxx.sharepoint.com/sites/Developer"

$Context = Get-SPOContext -Url $Url -UserName $UserName -Password $Password
$List = $Context.Web.Lists.GetByTitle($ListTitle)

#Retrieve field
$field = $List.Fields.GetByInternalNameOrTitle($FieldName)


write-host Done
  • Thanks so much for your help! That worked great! I'm still really new to PowerShell and the SharePoint Object Model. I need to do some studying up on it when I get a chance.
    – BenGrady
    Dec 4, 2017 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.