I'm trying to make a field in Edit mode hidden by using this code below :-

$web = $context.Web
$site = $context.Site 
$list = $web.Lists.GetByTitle("Test List");

$fields = $list.Fields["TestHidden"];

# Controls Field in Edit Form
$fields.SetShowInEditForm = $false;


But i'm getting the error:- Property 'SetShowInEditForm' cannot be found on this object; make sure it exists and is settable.- SharePoint Online

Any ideas what am i missing?


In SPO, the SetShowInEditForm is a method and not a property.

You can "set" the value as below:


Reference - Field.SetShowInEditForm method

| improve this answer | |
  • THanks for that. But now i get error: You cannot call a method on a null-valued expression. At C:\Powershell\HideColumnINModes.ps1:20 char:1 + $fields.SetShowInEditForm($false); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ – naijacoder May 5 '17 at 1:57
  • Got it.Changed my code to $field = $list.Fields.GetByInternalNameOrTitle("TestHidden"); – naijacoder May 5 '17 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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