Encoding SharePoint Field names.

less than 1 minute read

During my last projects I have been asked the same questions. The question was how can you get the normal name of a SharePoint field name that is encoded like this: Test_x0020_ Name.

The field names get encoded because XML elements names can’t contain spaces or other different characters. In the example above the x0020 represents the space and the _ represents a delimiter.

You can decode those SharePoint fields by using:

System.XML.XmlConvert.DecodeName("[Fieldname]") ;

You can encode fieldnames if you would like by using:

System.XML.XmlConvert.EncodeName("[FieldName]")

Hope this helps you when developing for SharePoint and remember when you have questions about Microsoft technology don't be afraid to ask.