sharepoint field DisplayName InternalName StaticName special character conversion

Copper Contributor

If you create a new site column (field) that contains blanks or special characters, through the sharepoint GUI, then microsoft will convert those characters when it generates the InternalName and StaticName.

For example, 

DisplayName = "Test or Test(s)"

InternalName = StaticName = Test_x0020_or_x0020_Test_x0028_s_x0029_

 

However, if you use an API call to create the site column , for example Add-PnPField, it will allow you to create an InternalName that does not follow this convention. i.e. one that contains spaces and special characters

eg. 

Add-PnpField -DisplayName "Test3 or Test(s)" -InternalName "Test3 or Test(s)" -Type Text

 

this will result in the following Field object:

DisplayName = "Test3 or Test(s)"

InternalName = "Test3 or Test(s)"

StaticName = Test3_x0020_or_x0020_Test_x0028_s_x0029_ 

 

Questions:

1. If you create a field object, with blanks and special characters will this cause problems in the operation of sharepoint?

2. why does microsoft perform conversions of blanks and special characters?

3. what is the best way to replicate this behaviour when using an API call to create a FIELD object?

4. what is the best practice recommended by microsoft when creating  a field object via an api call with regards to InternalName and Static Name

 

 

 

 

 

 

0 Replies