Resolving Mismatched Display Names And Internal Names In Sharepoint Columns

When creating columns in SharePoint, an internal name is assigned to uniquely identify the column while a display name is shown to end users. Over time, as modifications are made, the display name may no longer match the internal name which can cause confusion for users and issues with any customizations.

This guide will cover what causes such mismatches between SharePoint column display names and internal names, the impacts it can have within an environment, how to diagnose the issues, the necessary steps to remediate them, and best practices around proactively managing columns and planning changes.

What Causes Mismatched Names in SharePoint Columns

There are two common scenarios that can create a mismatch between the display name and internal name for SharePoint columns:

Renaming Columns After Creation

When a SharePoint column is originally created, the display name and internal name match and are set based on the name provided. However, the display name can be changed after creation through the user interface without updating the internal name.

For example, a column called “Department” may get renamed to “Business Division” to better reflect the business. The internal name would stay as “Department” while the display name shown to users is updated to “Business Division”.

Migrating Content Between SharePoint Environments

When content databases get migrated between SharePoint environments such as from production to staging or test to production, the internal names stay the same but display names could be changed in the new environment.

For example, a column “Client Account Manager” in production could get renamed to “Account Manager” in staging. All customizations that reference the internal name would still be valid but users would see the updated display name.

Impacts of Mismatched Column Names

Allowing internal names and display names to get out of sync can cause a number of issues:

Confusion for Users

When users see different display names than expected for columns, it can lead to confusion around what data a particular column contains. If names seem out of date or inconsistent, it can reduce confidence in the quality of information.

Issues With Customizations and Integrations

Any customizations like custom forms, workflows, or InfoPath may reference the column internal name. If the displayed name is updated but internal name does not change, this can cause discrepancies.

Additionally, external integrations from tools like Power BI that connect using the SharePoint API reference the internal name. If this no longer aligns with what users see, it can cause broken integrations.

Finding Columns with Mismatched Names

Being able to reliably find columns with mismatched names between display name and internal name is important for diagnosing the root cause. PowerShell provides an effective way to efficiently check for and identify discrepancies.

Using PowerShell to Compare Display Names and Internal Names

Two main PowerShell commands can be used – Get-SPField which returns the column definitions and using it to compare DisplayName vs InternalName for differences.

Identifying Discrepancies

By finding columns where DisplayName does not match InternalName, a list of mismatched columns can be generated for further investigation. This can be output to a CSV file for easy analysis in Excel.

Fixing Mismatched Names

Once any offending columns have been identified, the fix requires updating to realign the display name and internal name:

Using PowerShell to Update Display Names

The Set-SPField PowerShell command can be utilized to change the DisplayName to match the InternalName for any columns found to have issues.

Updating Links, Customizations, and Integrations

Any customizations or external integrations leveraging the previous display name would also need to be updated after it is changed to ensure no disruption of service.

Example PowerShell Scripts for Diagnosis and Remediation

PowerShell provides helpful scripting capabilities for both diagnosing mismatched column names and remediating them. Useful example scripts include:

Get-SPField Script to Compare Names

$web = Get-SPWeb "https://example.sharepoint.com/sites/mysite"  
$list = $web.Lists["My List"]  

Compare-Object (
$list.Fields | ForEach-Object { $_ | 
Select-Object InternalName, DisplayName }
) -Property InternalName, DisplayName -IncludeEqual | 
Export-Csv C:\temp\columncomparison.csv

This exports a CSV file with side-by-side InternalName and DisplayName for easy comparison to find mismatches.

Set-SPField Script to Update Display Names

$web = Get-SPWeb "https://example.sharepoint.com/sites/mysite"    
$list = $web.Lists["My List"]   

$list.Fields | ForEach-Object {
    if ($_.InternalName -ne $_.DisplayName) {
        $_.DisplayName = $_.InternalName 
        $_.Update()    
        Write-Host "Updated" $_.InternalName
    }
}

This loops through all columns and updates DisplayName to match InternalName where differences exist.

Additional Considerations and Best Practices

Following some best practices around SharePoint column management can help prevent issues with mismatched names occurring downstream:

Proactively Monitoring Columns

Schedule regular PowerShell scripts to scan for and flag any columns with inconsistencies to the governance team. This allows names to be reconciled preemptively before causing any impacts.

Planning Name Changes in Development Environments First

Test and stage new column names changes first in development environments and use PowerShell there to identify any impacts early before deploying changes into production.

Leave a Reply

Your email address will not be published. Required fields are marked *