0

I am trying to create a site column named "Subject" or type managed metadata, I created the column first with the name: "vrdSubject", then I am trying to rename the column to "Subject", but I keep getting the error:

"The column name that you entered is already in use or reserved".

I renamed the other subject field that comes out of the box to Subject1, and then tried to add my column, but didn't work. Do I have to delete the out of the box Subject field? Can't we have two columns with different inner names but same display nanme?

0

Technically we can have two columns with the same display name but different internal name but when we try to create this from the SharePoint UI, it does not allow, it throws the above-mentioned error ("The column name that you entered is already in use or reserved").

However, it allows using the coding approach like visual Studio, PowerShell and PnP PowerShell So, we can create the two site columns with the same display name using any of the coding techniques not from the UI.

PnP PowerShell to create a site column (text type)

#Config Variables
$SiteURL = "https://crescenttech.sharepoint.com"
$ColumnTitle = "Project Name"
$ColumnInternalName = "ProjectName"
$ColumnGroup="Crescent Site Columns"
$ColumnType = "Text"

#Get Credentials to connect
$Cred = Get-Credential

Try {
    #Connect to PNP Online
    Connect-PnPOnline -Url $SiteURL -Credentials $Cred

    #Create Site Column
    Add-PnPField -DisplayName $ColumnTitle -InternalName $ColumnInternalName -Group $ColumnGroup -Type $ColumnType
}
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}

Using PowerShell create a site column (text type)

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Parameters
$SiteURL="https://crescent.sharepoint.com"
$ColumnName="ProjectCode"
$IsRequired = "TRUE"
$ColumnGroup="Crescent Projects"

Try {
    $Cred= Get-Credential
    $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Credentials

    #Get all Site columns from the site
    $Fields = $Ctx.web.Fields
    $Ctx.Load($Fields)
    $Ctx.executeQuery()

    #Check if the column name exists
    $NewField = $Fields | where {$_.Title -eq $ColumnName}
    if($NewField -ne $NULL)  
    {
        Write-host "Site Column $ColumnName already exists!" -f Yellow
    }
    else
    {
        #Define XML for Field Schema
        $FieldSchema = "<Field Type='Text' DisplayName='$ColumnName' Name='$ColumnName' required='$IsRequired' Group='$ColumnGroup'/>"
        $NewField = $Fields.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
        $Ctx.ExecuteQuery()    

        Write-host "Site Column Created Successfully!" -ForegroundColor Green  
    }
}
Catch {
    write-host -f Red "Error Creating Site Column!" $_.Exception.Message
}

Source of above script :

SharePoint Online: Create a Site Column using PowerShell

| improve this answer | |
0

If you want pure SharePoint UI solution then you also need to rename 3 additional SharePoint OOTB site columns. These can be accessed through URL only, I haven't found a direct link to those columns.

URLs for additional site columns to rename:
http://SITE_COLLECTION_URL/_layouts/fldedit.aspx?field=LinkDiscussionTitle http://SITE_COLLECTION_URL/_layouts/fldedit.aspx?field=LinkDiscussionTitle2 http://SITE_COLLECTION_URL/_layouts/fldedit.aspx?field=LinkDiscussionTitleNoMenu

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.