Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise, and I am using publishing portal template. I heard for SharePoint list/list column, it has an internal name which could be used for programming (as identifier for list/list column), and also has a display name (which is showed for end user for list name or list column name).

How to find and set such internal name and display name for list/list column?

share|improve this question
add comment

7 Answers 7

up vote 17 down vote accepted

The dumbed down answer (Anders and Jaap are smarter than I am) is this:

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 Desciption 1' ---> Product_x0020_Description_x0020_
  • 'Product Desciption 2' ---> Product_x0020_Description_x0020_0
  • 'Product Desciption 3' ---> Product_x0020_Description_x0020_1

etc.

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:

/_layouts/FldEdit.aspx?List=%7B37920121%2D19B2%2D4C77%2D92FF%2D8B3E07853114%7D&Field=Product%5Fx0020%5FDescription

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.

Methinks this has turned into a blog post for me! (UPDATE 2009-12-14: I did indeed post an edited version of this to my blog, and the comments and discussion have been interesting.)

M.

share|improve this answer
2  
Well explained Marc. Thanks for the tip to use the url tip! –  Jaap Vossers Dec 11 '09 at 16:23
    
Can I change internal name either in programming way or from any tools? –  George2 Dec 11 '09 at 18:57
1  
heh yeah i often use that shortcut too ;-) George: why would you rename internal names? As Marc explained for columns/fields created in the GUI you should just omit spaces when you create them, then add them afterwards. Also you dont have this issue at all if you use features or code to create them. –  Anders Rask Dec 11 '09 at 20:20
    
Marc, I have created a list but with wrong internal name -- could confuse other people in the future. I want to save my efforts to re-create the list again and try to find a quick way to change intrenal name. Any solutions to change the internal name? –  George2 Dec 12 '09 at 14:59
    
Cool, question answered! –  George2 Dec 13 '09 at 7:34
add comment

You can use SharePoint Manager to inspect properties of existing fields, including the InternalName

share|improve this answer
    
Can I change internal name? –  George2 Dec 11 '09 at 18:43
add comment

aside from using Sharepoint Explorer (wich is probably the best option), and in case that you need only the column internal name, you could also use u2u caml query builder. Also, you can find the column internal name when you browse the list, on its configuration page, and select any of the available columns. You can see that the internal name it is passed as an argument in the query string, inside the 'Field' key.

share|improve this answer
    
I create the list from SharePoint UI by adding List/Columns, then can I change internal name either in programming way or from any tools? –  George2 Dec 11 '09 at 19:01
add comment

Actually there are three strings involved, as can be easily seen from object model examination (or use of SharePointExplorer).

  1. DisplayName/Title

  2. StaticName

  3. InternalName

The StaticName of the site column can be updated by changing it in the feature ("StaticName" attribute) and redeploying. Then if the feature receiver gets the SPSite.SPField and calls Update, that will update the StaticName of all list instances.

The InternalName of the site column can be updated by changing it in the feature ("Name" attribute) and redeploying.

However, the site column InternalName is not propagated to list instances via SPField.Update, and AFAICT, cannot be changed, updated, or fixed at all.

Perhaps it is possible by twiddling with the underlying rows in the database, but that is obviously unsupported.

share|improve this answer
add comment

If you mean list template ID's you can find them here: http://msdn.microsoft.com/en-us/library/dd586520(office.11).aspx

Also theres the FieldId and PropertyConstant classes:

FieldId defines constants that you should use to reference SharePoint fields. PropertyConstants is the same deal, but for UserProfile fields.

Theres also lots of enumerations that you should use instead of hardcoding strings or id's. You will need to go scouting the API for a complete list, but one such enum is the ListType enum

hth Anders Rask

share|improve this answer
    
I create the list from SharePoint UI by adding List/Columns, then can I change internal name either in programming way or from any tools? –  George2 Dec 11 '09 at 18:58
add comment

http://blog.trivadis.com/b/simonamrein/archive/2011/09/22/sharepoint-internal-field-names-display-names-id-s.aspx

share|improve this answer
1  
welcome to our site. Please dont just link to external answers. Also include a short comment on solution. Links tend to be short lived and we plan to stick around... :) –  Anders Rask Sep 22 '11 at 17:39
add comment

Better idea is Delete column and Recreate.Is the Best solution

share|improve this answer
    
@Naresh: That's fine if no lists use the data in the column. In any other case the data will be lost. –  Alex Angas Jan 28 '10 at 22:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.