Pages

Sunday, October 24, 2010

SharePoint: StaticName, InternalName, DisplayName. Which one to use in case of Multilingual supported site?

SharePoint provides three different names for referring a field: DisplayName, Intername and StaticName. You can get more details on these three properties in the MSDN post. In short, Display name is what you see in the site. Internal name is the readonly name which is created when the filed in created and can’t be modified i.e., readonly and the name should be unique. Static name doesn’t need to be unique and can be changed. If you don’t change the static name, internal name and static name are same.

 

Ok, let’s come to point. We used to access list item’s value by using display name as shown below:

var value = ListItem[DisplayName]

The problem in this approach is that if display name can be different for different language. So using display name can work in a language but may not work in different language.

 

Problem I experienced in using Display name

I was working on content approval related stuffs. And I had found the approval status is kept in a field whose display name is ‘Approval Status’. So I had used code like shown below to get the approval status field value.

ListItem[‘Approval Status’]

Unfortunately, my client was using German version and when I deployed I found my code is not working. After spending some time I had figured out the column ‘Approval Status’ is missing in the list. And I finally figured out the column name is not ‘approval status’ but it’s German equivalent.

 

So, which one to use from InternalName, StaticName, DisplayName?

So which field to use when? If you need to access custom field created by you or your team, you can use display name (considering you are using different display name for different language) . If you are using any SharePoint provided field then better to use StaticName or Intername, since you are not sure if the display name will be changed or not.

2 comments:

  1. Hi,

    there is a little mistake. End of para 1 "If you don’t change the static name, internal name and static name are same."

    Internal name and static name are not the same necessarily.
    Internal name has other length limitations then static name and encoding of german umlauts from display name is different.
    F.E. creating field with name
    "Eingangskontrolle für OE-Typen"
    results in internal name "Eingangskontrolle_x0020_f_x00fc_", but static name "Eingangskontrolle_x0020_für_x0020_OE-Typen" on a german SP 2010.

    Best Regards
    MartinS42

    ReplyDelete
  2. Thanks Martin for this info. My mistake. Again thanks for sharing..

    ReplyDelete

Note: Only a member of this blog may post a comment.