Powershell: How to convert a ‘Single line of Text’ column to ‘Multi-line of Text’

Problem: Customer needed a way, via PowerShell to convert a column from single line of text to Multi-line of text. I first verified that the column they were trying to convert was not the default ‘Title’ column, I would not recommend touching that one. The customer had run into an issue where the Single Line of text column’s 255 character limit was truncating some entries.

Solution:

$web=Get-SPWeb "https://nameOfSite"

$list = $web.Lists["NameOfList"]

$column = List.Fields["ColumnName"]

$script:noteFieldType = [Microsoft.SharePoint.SPFieldType]::Note

$column.Type = $noteFieldType

$column.Update()

$web.Dispose()

NOTE: Remember to run these scripts with the correct permissions. When the customer ran it the first time, they had some vague errors like 'Cannot index into a null array'. Found out they were logged into the server as themselves, once they logged in as a farm account, the script worked fine.

Fight Comparison:
Mike Tyson Vs. Carl ‘The Truth’ Williams…easy KO

Comments

  • Anonymous
    July 15, 2014
    The comment has been removed
  • Anonymous
    January 17, 2015
    @Michael, how did you go about changing the schemaxml? Did you extract it and update some tags then just $column = $modifiedXml? If so then what tags where required? Thanks for a great post!