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

There 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(““);
SPWeb myWeb = mySite.OpenWeb();
SPList myList = myWeb.Lists[““];
SPField myField = myList.Fields[“MULTILINE-FIELDNAME”];
((SPFieldMultiLineText)myField).UnlimitedLengthInDocumentLibrary = true;
and you can also make the same things with site column definition in element.xml

The Multiple Lines of Text Field

The Lookup Field
The Lookup field is the only field type that cannot be created with a simple feature such as this one. The cause for this is the fact that this type of field references a column of a list using the list’s ID, and a list’s ID is dynamically generated when a list is created.
This means that there is no way one can predict what will be the ID of the list referenced by the Lookup field when the feature is developed. This value is only known when the feature is activated in a specific web site.
But we can write feature receiver for that and can write code on feature activation

About Krishana Kumar

Krishana Kumar is SharePoint Architect/Trainer having Architecture experience with high volumes at Enterprise level and global scale - creation of highly scalable solutions with global user base and geographically distributed architectural components. Good knowledge of SharePoint best practices and governance models. I hold Two Master degree in Computer Science with over 11 years of experience working on Microsoft Technologies specially SharePoint, Project, .NET and other Information Worker Technologies. Having good exposer in Client side scripting Angular.js, backbone and Node. I am currently responsible for SharePoint Infrastructure set up and leading teams in various medium and large scale projects, architecting, designing & installing SharePoint farms, developing custom components,, and providing advanced SharePoint administration and development training to teams and customers. I regularly speaks in various SharePoint User Groups and other Events. I have MCSA Windows Azure, MCSA Office 365, MCSE & MCSD SharePoint 2013, Microsoft Certified Developer (MCD) and holds MCPD, MCTIP and MCTS for SharePoint 2010, MCTS MOSS 2007 & WSS 3.0, MCPD, MCITP (EPM 2010 & 2007) and MCSD .NET.
This entry was posted in General Interest. Bookmark the permalink.

Leave a Reply

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