0

I have a field which was created at the list level inside my online SharePoint site, and i want to hide it from the create form, so i run the following PnP code:-

PS C:\WINDOWS\system32> Connect-PnPOnline -Url https://****.sharepoint.com/sites/***
PS C:\WINDOWS\system32> $fieldTitle = "ClosureSummary"
PS C:\WINDOWS\system32> $list2 = Get-PnPList -Identity Lists/ProjectUpdateSystem
PS C:\WINDOWS\system32> $customfield = $list2.Fields.GetByInternalNameOrTitle($fieldTitle)
PS C:\WINDOWS\system32> $customfield.SetShowInNewForm($false)
PS C:\WINDOWS\system32> $Context.ExecuteQuery()
PS C:\WINDOWS\system32> $customfield.UpdateAndPushChanges($true)
PS C:\WINDOWS\system32> $Context.ExecuteQuery()

Now i did not get any error but the field is still showing inside the list create form, any advice?

1

This worked for me. Used field.Context.ExecuteQuery()

$list = Get-PnPList -Identity Lists/Contact
$customfield=Get-PnPField -List $list -Identity "Title"
$customfield.SetShowInNewForm($false)
$customfield.UpdateAndPushChanges($true)

$customfield.Context.ExecuteQuery()

1
  • worked for me also thanks
    – John John
    Oct 9 '20 at 21:14

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.