Any time you want to address a Document Library or List using CAML, or you want to populate a Document Library or List item metadata using the Object Model, you invariably need to know the “internal” names of the columns.
With CAML you have to use the internal column name, as opposed to the columns display name, so how do you find out what the iternal column names are? If it’s for a list you’ve created, and you haven’t changed any column names, then the internal names match the display names. If you change the column name, it’s internal name remains the same as when originally created and only the display name is changed.
And you can always check what the internal column names are, using the CAML Query Builder tool.
So far so good, how about OOTB column names. like “Title”, “Name” and so on, or custom column names whose internal name seems to bear no resemblance to its display name. Well there’s another trick, navigate to your list/document library and ensure that the required columns are displayed on some View.
Here I’ve chosen the following columns to display on the View:
- Name (linked to document with edit menu)
- Name (linked to document)
- Name (for use in forms)
- Type (icon linked to document)
To find out what the internal names for these columns are, click on the column header to sort the list by that column, then take a look at the URL in your browser;
I clicked on the Name column (the one with the edit menu), looking at the SortField parameter in the URL, this turns out to be the “LinkFilename” column. Clicking on the Type column shows me that the internal name for this is “DocIcon”.