Good old George2 asked a question over at SharePointOverflow.com about SharePoint list and column names today. If you don’t know it, SharePointOverflow.com is an excellent site to get high-end SharePoint assistance! I liked my response, so here it is as a blog post.
When you create a column on a list, both its DisplayName and StaticName are set to the same value. However, the StaticName contains converted values for some characters, most notably a space ‘ ‘ is converted to ‘x0020’. So if the DisplayName is ‘Product Description’, then the StaticName will be ‘Product_x0020_Description’.
There’s another little bugaboo: The StaticName is limited to 32 characters including the translations for special characters. Because of this, if you have more than one column with the same first 20 characters, SharePoint creates StaticNames as follows:
- ‘Product Description 1’ —> Product_x0020_Description_x0020_
- ‘Product Description 2’ —> Product_x0020_Description_x0020_0
- ‘Product Description 3’ —> Product_x0020_Description_x0020_1
Clearly this renumbering can get confusing, too, so a lot of folks will create their columns without spaces in the names (ProductDescription1) and then change the DisplayName.
The easiest trick to see what the StaticName is (to me), to go to List Settings, and then click on the column name in which you are interested. On the Change Column page, the URL will end in something like:
The StaticName is the value for the Field parameter in the QueryString. However, there’s more encoding to deal with: the underscores (‘_’) are converted to ‘%5f’. So Product%5Fx0020%5FDescription means Product_x0020_Description again.
Whenever you change the DisplayName, the StaticName stays, well, static. This often results in DisplayNames and StaticNames that have nothing to do with each other, so as you are prototyping, it’s a good practice to delete columns and re-add them if you are changing their purpose and therefore their name.