Hello all,
How do I create a column with different internal name and display name in powershell?
I use the following xml
Powershell I use
How do I create a column with different internal name and display name in powershell?
I use the following xml
<?xml version="1.0" encoding="utf-8"?><Fields><Field Type="Choice" DisplayName="Question One" Required="TRUE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="RadioButtons" FillInChoice="FALSE" StaticName="Question" Name="Question" ColName="nvarchar3" RowOrdinal="0" Version="1"><CHOICES><CHOICE>1</CHOICE><CHOICE>2</CHOICE><CHOICE>3</CHOICE><CHOICE>4</CHOICE><CHOICE>5</CHOICE></CHOICES></Field></Fields>
Powershell I use
......
.......
$templateXmlLocation = ($currentFolderPath + "\" + $xmlFile); //Path to the xml file
$templateXml = [xml](get-content $templateXmlLocation)
foreach ($node in $templateXml.Fields.Field)
{
$spList.Fields.AddFieldAsXml($node.OuterXml, $true,[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
}
$spList.Update()
When the column is created, its internal name comes as "Question_x0020_One instead of just Question. Kindly help.