2

I have set the property .Hidden of one field to $true.

$field=$List.Fields.GetByTitle("Business Phone")
$ctx.ExecuteQuery()
$field.Hidden=$true

The change has been applied successfully and if I check that property $field.Hidden shows $true.

The result is that when I am trying to add a new item to my list, the field is not shown, which is expected and desired, but it still exists in the default view and I can add it to a new view.
According to MSDN description "If TRUE, the field is completely hidden from the user interface. Setting ReadOnly to TRUE means the field is not displayed in New or Edit forms but can still be included in views."

  • Not a required field. It is one of the default fields that comes with a contact list but it is not a required one.
  • Name is correct. It is certainly this column, not another one with similar name/internal name, that I am updating. Other changes (like description) are visible in GUI.
1

You can control the field display by using other properties for each form (new, edit and display form). You can overwrite them by using this code :

$field=$List.Fields.GetByTitle("Business Phone")
$ctx.ExecuteQuery()
$field.SetShowInDisplayForm($false)
$field.SetShowInEditForm($false)
$field.SetShowInNewForm($false)

$Context.ExecuteQuery();

Don't forget to launch the ExecuteQuery method.

  • I'm getting "Property 'ShowInDisplayForm' cannot be found on this object; make sure it exists and is settable." for all the three properties. Are you sure they are available for SharePoint Online? – grisha Jan 28 '15 at 12:17
  • Sorry for the mistake, I've fixed the code and tested it on my office 365 portal. Validate if it's ok ;) – KhalilG Jan 28 '15 at 16:13
  • Ok, valid. The field disappeared from the Edit/Display/New form but it is still in the default view, not hidden completely from GUI. I'm starting to think it's by design, only the documentation is misleading. – grisha Jan 29 '15 at 9:54
  • You can edit the default view programmatically, but If you could do it form the interface it would be better (and cleaner). – KhalilG Jan 29 '15 at 10:32
  • 1
    First of all, you need to update the field before calling the ExecuteQuery method : $field.Hidden=$false $field.Update() $Context.ExecuteQuery(); Secondly, if the field has already been added to the view, and then you set it to be hidden, the field will disappear from the columns list in the list settings page, but will remain visible in the view. You need to remove it from the view before setting it to be hidden. – KhalilG Jan 29 '15 at 16:31
0

Please verify following:

1) Go to List Settings > Advanced Settings:

2) Select Yes on Allow management of content types?

3) Click on one of the existing content types under the Content Type section

4)Next, click on the column you intend to hide and check if following setting is enabled.

enter image description here

  • Thanks, but I am getting exactly the same results. Did your columns completely disappear? – grisha Jan 23 '15 at 14:18

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.