0
votes

I'm working on custom lists of sharepoint 2013.

I created many lists in each one I want to hide the standard column "Title" from visual studio . I know how to deal with this in SharePoint Site ( by making this field hidden in the column list ) , but every time I make changes in my list ( in visual studio) and deploy the project , the Title field becomes required.

Is there a way to force the "Title" standard column to "hidden" in visual studio ?

can anyone help me Please?

3

3 Answers

1
votes

You can use this -

using (ClientContext ctx = new ClientContext("http://siteUrl"))
    {
        Field field = ctx.Web.Lists.GetByTitle("myListName").Fields.GetByTitle("Title");
        field.Hidden = true;
        field.Required = false;
        field.Update();
        ctx.ExecuteQuery();
    }
0
votes

This happens when your list inherits from the default parent content type, such as "item".

So I recommand to : 1 - create your custom content type, disable the inheritance from the parent content type 2 - create your custom list and delete the default content type and replace it by the custom one.

Hope this can help.

0
votes

You can follow the Solution Hemi has provided bu there is one another way you can think a workaround for this. You can delete that column from the view itself.

Please have a look at this code.

SPView view = list.DefaultView;

if(view.ViewFields.Exists("LinkTitle")) 
{

   view.ViewFields.Delete("LinkTitle");

   view.Update();

}