How-to create site columns with identical display names in SharePoint Online - #ARCHIVED#

This content has been archived. It may no longer be relevant.  

SharePoint Online does not allow you to create site columns with identical display names when using a web browser. When using PnP PowerShell to create site columns, identical display names can be used. The internal names have to be different though.

The following code creates two site columns with identical display names. The only differences are the attributes “ID” and  “Name”.

$guid = [guid]::NewGuid()
$xml = '<Field
    ID="' + $guid + '"
    Group="Group"
    Type="Text"
    DisplayName="Site Column"
    Name="sitecolumnone">
</Field>'
$pnpField = Add-PnPFieldFromXml -FieldXml $xml

$guid = [guid]::NewGuid()
$xml = '<Field
    ID="' + $guid + '"
    Group="Group"
    Type="Text"
    DisplayName="Site Column"
    Name="sitecolumntwo">
</Field>'
$pnpField = Add-PnPFieldFromXml -FieldXml $xml