I am new to sharepoint. I am trying to create a list using C#.
SPList list = web.Lists["MyList"];
list.OnQuickLaunch = true;
list.Fields.Add("Col1", SPFieldType.Text, true);
list.Update();
The new field created “Col1”, is not displaying in the list. However, I am able to view this field in the list setting. To make it visible, I have make display enable in the View (default view i.e., All Items).
My question is can I achieve it programmatically? I have searched in Stackoverflow and google but could not find the satisfactory answer.
TIA,
Idds.
You have to get a reference to the
SPView, add the field to theViewFiledscollection and update.