I created a list and added three columns to it. When I look at a list on the List Options page, I see three columns that I created, and some by default (Title, Created and and Modified By). When I look at the items in the list, I just see the columns that I created.
My problem is that when I try to get a list of columns for my list from code, I get a whole bunch of others that I can't see anywhere (version, attachments, number of children, etc.)
Here is the code I use to get this list:
List<string> visFields = new List<string>();
foreach (SPField field in myList.Fields)
{
if (!field.Hidden)
{
visFields.Add(field.Title);
}
}
return visFields;
Is finding fields the wrong way? How can I get the same list of columns that appears when viewing items in a list?