change a multi line text field to allow unlimited length in a document library

here is a restriction on number of characters (255 characters) allowed for a Multi line text field added to a document library when you try to input more than 255 characters through UI.

Attaching a sample code which will help in working around the problem of restriction on number of characters (255 characters) allowed for a Multi line text field added to a document library.

SPSite mySite = new SPSite(“<http://SiteURL>”);

SPWeb myWeb = mySite.OpenWeb();

SPList myList = myWeb.Lists[“”];

SPField myField = myList.Fields[“MULTILINE-FIELDNAME”];

((SPFieldMultiLineText)myField).UnlimitedLengthInDocumentLibrary = true;

myField.Update();

Leave a Reply

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

Bitnami