“This field can have no more than 255 characters.” Error in Multiline Text Columns

Getting  “This field can have no more than 255 characters.” error on SharePoint Multiple lines of text  columns?

Well, the fix is simple, we’ve the property  “Allow Unlimited length in document libraries” on Multiple lines of text fields. Once enabled, technically it can hold content up to 2 GB.

This field can have no more than 255 characters

We can also set this property programmatically either with C# or PowerShell:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

#Get-SPSite cmdlet for MOSS 2007
function global:Get-SPSite($url)
{
    return new-Object Microsoft.SharePoint.SPSite($url)
}

#Get-SPWeb cmdlet for MOSS 2007
Function global:Get-SPWeb($url)
{
  $site= New-Object Microsoft.SharePoint.SPSite($url)
        if($site -ne $null)
            {
               $web=$site.OpenWeb();
       
            }
    return $web
}
  
#Parameters
$web = Get-SPweb "https://sharepoint.crescent.com/regions/emea/se/"
$ListName = "Employee of the Month"
$FieldName = "Desciption"

#Get the List 
$list = $web.lists[$ListName]

#Set the "Allow unlimited length in document libraries" option to true programmatically
$list.Fields[$FieldName].UnlimitedLengthInDocumentLibrary= $true

#Update the Field
$list.Fields[$FieldName].update()

C# code:

static void Main(string[] args)
{
	SPSite mySite = new SPSite("https://sharepoint.crescent.com/regions/emea/se/");
	SPWeb myWeb = mySite.OpenWeb();

	SPList myList = myWeb.Lists["Employee of the Month"];
	SPField myField = myList.Fields["Description"];

	((SPFieldMultiLineText)myField).UnlimitedLengthInDocumentLibrary = true;
	myField.Update();
}

Unfortunately, in some of the OOTB list fields, “Allow Unlimited length in document libraries” property is not included in the field definition. E.g. “Description” field in SharePoint picture libraries! What’s the workaround? Create a New multiline column and copy values from the existing OOTB column!

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!

Leave a Reply

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