Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint: Make a list field hidden programmatically

Tags:

sharepoint

I'm trying to hide the "Title" field in a list. This doesn't seem to work:

SPList myList;
...
SPField titleField = myList.Fields.GetField("Title");
//titleField.PushChangesToLists = true; <-- doesn't seem to make a difference
titleField.ShowInEditForm = false;
titleField.ShowInDisplayForm = false;
titleField.ShowInNewForm = false;
titleField.Update();
//myList.Update(); <-- make no difference

What am I doing wrong?

like image 269
vitule Avatar asked Nov 14 '08 14:11

vitule


People also ask

How do I create a hidden column in a SharePoint list?

Go to the list or library where you want to show or hide columns. , then select Column Settings > Show/hide columns. In the Edit view columns pane, check (to show) or uncheck (to hide) the box for the column or columns as needed.

How do I hide a field in SharePoint form?

At the top of the form, select Edit form > Edit columns. In the Edit columns pane, check (to show) or uncheck (to hide) the checkbox for the column or columns as needed.

Can SharePoint list be hidden?

You can also hide a SharePoint Online list or document library by setting its permissions so that only specific users have access to it. Go to the List or Library settings page >> Click on the Permissions for this list link. Click on the 'Stop Inheriting Permissions' button.


1 Answers

Try this:

field.Hidden = true;
field.Update();
like image 195
Brian Liang Avatar answered Nov 13 '22 03:11

Brian Liang