Get Internal Name of a Column in SharePoint Online using PowerShell

Requirement: Get the internal name of a SharePoint Online list column using PowerShell

How to Get the Internal Field Name in SharePoint Online?

As explained in my other post: SharePoint Field Display Name vs Internal Name, When you create a new column in SharePoint, You give a “Title” to it, which becomes the “Display Name”. The internal name is automatically assigned by SharePoint from the display name by replacing all special characters and space with Unicode encoding. A field can have the same internal name or a different name from its display name (E.g. “Created by” field’s internal name is: Author!). And this internal name stays static – even if you change the field’s title. At times, You may need the internal name of a column to retrieve field values in SharePoint.

Here is how to find the internal name of a field in the SharePoint Online list:

  • Navigate to the List or Document Library >> Click on Settings >> List Settings
  • Under the Column section, click on any of the columns, and you can get the column internal name in URL from the Field parameter value. E.g. In my case, its: “Project_x0020_Classification”sharepoint online get column internal name


You can also sort the column and get the internal name of it from the SortField parameter value.

sharepoint online powershell get internal field name
Is it possible to change column internal name in SharePoint Online? The answer is: NO! You can’t change the internal name of a field in SharePoint. The only workaround is: Delete and Recreate the column.

SharePoint Online: PowerShell to Get Internal Field Name

If you need to reference the column in your code or other scripts – This handy PowerShell script helps you to get the internal name of a column. Let’s get the field internal name from its display name in SharePoint Online:

#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/PMO"
$ListName ="Projects"
$FieldTitle = "Project Classification"

#Get Credentials to connect
$Cred= Get-Credential

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
         
#Get the List and field
$List = $Ctx.Web.Lists.GetByTitle($ListName)
$Ctx.Load($List)
$Field =  $List.Fields.GetByTitle($FieldTitle)
$Ctx.Load($Field)
$Ctx.ExecuteQuery()

         
#PowerShell to get internal name of sharepoint online list column
Write-Host $Field.InternalName
It’s a good idea to create a column without space or special character initially, So that the field internal name will be neat and clean, and then change the field’s title with any special characters or space if required!

SharePoint Online: PnP PowerShell to Get Internal Field Name

This time, let’s use PnP PowerShell to get the internal field name of all fields from a SharePoint Online list.

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/PMO"
$ListName ="Projects"
$FieldTitle = "Project Classification"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the list column
Get-PnPField -Identity $FieldTitle -List $ListName | Select InternalName

How about getting internal names of all fields in a list?

#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/PMO"
$ListName ="Projects"

Try {
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive
    
    #Get list column internal names
    Get-PnPField -List $ListName
}
Catch {
    Write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply