Search code examples
sharepointlistfield

Sharepoint list internal name creation policy


i have a list lets call it as

List1 in List1 list i have fields like the following

List1
  ID
  Title

.... also i have List2 and its columns like the following

List2
 ID
 Title
 Type

now i added a lookup field from List2 to List1 and now my List1 columns becomes

 List1
  ID
  Title
  List2
  List2:Title

when i look at the List2:Title i see its internal name is List2_x003a_Title

i easily can understand that ':' is represented as x003a ie the hex code of ':' is x003a

after than i deleted column and readded it. oooooo what i see is that the field added with the same external name but this time its INTERNAL NAME

List2_x003A_Title

can someone explain the reason. when the hex code is x003a or x003A


Solution

  • SharePoint internal name creation policy: the name is encoded to a valid XML name according to the XML specification.

    Any XML name character that does not conform to the XML 1.0 spec (fourth edition) recommendation is escaped as _xHHHH_. The HHHH string stands for the four-digit hexadecimal UCS-2 code for the character in most significant bit first order. For example, the name Order Details is encoded as Order_x0020_Details.

    .NET Framework contains XmlConvert.EncodeName Method that converts the name to a valid XML name. This method guarantees the name is valid according to the XML specification.

    Example:

    var fieldName = XmlConvert.EncodeName("Order Details");  //returns Order_x0020_Details