How can I hide a form from Displaying a custom field that is created in my document library ? Its a document library and I am updating this column through itemadded() eventreceiver.

My issue is this column - NPDModifiedBy will be filled with my code in eventreceiver and should not be from sharepoint UI. So, i dont want to show this field, when end user uploads the document into my document library

How to hide this doc.lib column while uploading the document upload? [this is not a site column] [hide-doc-lib]1

  • Do you have Powershell access? Or Can we write custom JavaScript for hide particular filed? Feb 8 '17 at 12:31
  • Sam, am in ON-PREM, so have full control on my server , have written the code provided by Gautam, am checking now. Feb 8 '17 at 12:42
  • Yes, then It will work for you. Feb 8 '17 at 12:44

Try below powershell:

$web = Get-SPWeb https://sitecollection
$list = $web.Lists["ListName"]
$column = $list.Fields.GetFieldByInternalName("NPDModifiedBy")

#Change the ShowInEditForm and other properties and update objects
$column.ShowInEditForm = $false
$column.ShowInNewForm = $false
$column.ShowInDisplayForm = $false
$column.ShowInViewForms = $false
$column.PushChangesToLists = $true;

Reference - Hide column in display form

Hide list using powershell

  • Gautam ,thanks , but when i do this , my custom column is not getting updated by my code. in my ItemAdded() event receiver i am writing the code by updating this column within the runwithelevatedprivileges Feb 8 '17 at 12:37
  • Thats very strange, this code simply hides the column, have added $column.PushChangesToLists line here, but not sure it might help. Can you check ? Feb 8 '17 at 12:45

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.