2

Encoding SharePoint Field names.

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.

2 Comments

  1. this not true. in sharepoint 2010 field name “RTM1” will be encoded to “_0x0052_TM1”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.