How to Change Column Type in SharePoint List using PowerShell?

Recently, There was a requirement to change column types from “Single line of text” to “Multiple Lines of Text” in multiple lists. Needless to say, PowerShell is the most efficient way to get such things done in bulk.

Here is the PowerShell Script to change column type in SharePoint programmatically:

PowerShell to Change Column Type in SharePoint

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the Web where Lists Live
$web= Get-SPWeb "https://sharepoint.crescent.com/sites/Operations/"

#Define Array to hold Lists Names to Scan
$ListNames =  ("Design Documents", "Project Closure", "Metrics")

#Column to Change
$ColumnName ="Closing Notes"

 #Iterate through provided Lists 
foreach($ListName in $ListNames)
{
    #Get the List
    $list = $web.Lists.TryGetList($ListName) 
    if( $list -ne $null)
     {
        #Check if the list has our target column to change
        if($list.fields.ContainsField($ColumnName))
        {
           #Get the Column to Change
           $column = $List.Fields[$ColumnName]
   
           #Change the Column type to "Multiple Lines of Text"
           $column.Type = [Microsoft.SharePoint.SPFieldType]::Note
           $column.Update()
           Write-Host "Field type updated on: $($List.Title)"
        }
    }
}

$web.Dispose()

Done! Check SPFieldType in MSDN to get all available column types in SharePoint.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “How to Change Column Type in SharePoint List using PowerShell?

  • Thanks for sharing the tip.
    The solution you gave indeed works, the problem is that the field schema can remain a bit inconsistent. The Type=”Text” is correctly changed into Type=”Note” but other artefacts can remain. For example, you may have MaxLength set in it, which is not supported for Note fields.
    It seems to be safer to replace the SchemaXml of the field altogether. You can take the old SchemaXml, change Type to Note, remove MaxLength, add NumLines if needed.
    This may look like (when altering a site column):
    [Microsoft.SharePoint.SPField]$field = $web.Fields.GetFieldByInternalName(“SingleLineToAlter”);
    $field.SchemaXml = ‘
    $field.Update($true)

    Reply

Leave a Reply

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