Link to home
Start Free TrialLog in
Avatar of Howard Bash
Howard BashFlag for United States of America

asked on

Add-PnPFieldXML how to add internal field name

I have built a script which can create a DateField for a list.  Works fine.  However,  I can only set the DisplayName and do not seem to be able to set the Internal Name.  I have tried setting a StaticName in the xml as well, and when I look at the list, the column is there, but the internal name is not.

Here is the code:

$FieldXML= "<Field Type='DateTime' Name='$ColumnName' ID='$([GUID]::NewGuid())' DisplayName='$ColumnDisplayName' InternalName='$ColumnInternalName' Required ='TRUE' Format='DateOnly' FriendlyDisplayFormat='Disabled'></Field>"		

#Add DateTime Field to list
Add-PnPFieldFromXml -FieldXml $FieldXML -List "SomeListName"

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.