SharePoint: Custom Field Type for MultiLine text

When you add a custom field type that can hold more than the 255 characters you can't use a field of type SPFieldText because it has a max length of 255 characters.

An obvious candidate is to use the field type SPFieldMultiLineText. No problems so far. But... in your custom version of the fldtypes.xml file (for example fldtypes_mytypes.xml) you have to define your parent type of the custom field. You would expect a parent type named MultiLineText, but no, that would be too obvious. It should be Note. Not documented, such a pity...

For example:

<?xml version="1.0" encoding="utf-8" ?>
<
FieldTypes>
    <
FieldType> <Field Name="TypeName">LongText</Field>
        <
Field Name="ParentType">Note</Field>
        <
Field Name="TypeDisplayName">Long Text</Field>
        <
Field Name="TypeShortDescription">Long Text</Field>
        <
Field Name="UserCreatable">TRUE</Field>
        <
Field Name="Sortable">FALSE</Field>
        <
Field Name="AllowBaseTypeRendering">TRUE</Field>
        <
Field Name="Filterable">FALSE</Field>
        <
Field Name="FieldTypeClass">...full qualified class,assembly name...</Field>
        <
PropertySchema>
            <
Fields></Fields>
        </
PropertySchema>
        <
RenderPattern Name="DisplayPattern">
            <
Column/>
        </
RenderPattern>
    </
FieldType>
</
FieldTypes>

A link with some more info (in Spannish): http://www.ideseg.com/SharePointDestripandoElWiki4.aspx

Published Tuesday, September 18, 2007 2:42 PM by svdoever
Filed under:

Comments

Tuesday, September 18, 2007 8:58 PM by Links (9/18/2007) « Steve Pietrek’s SharePoint Stuff

# Links (9/18/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

Pingback from  Links (9/18/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

Wednesday, September 19, 2007 5:03 AM by Emmanuel Desigaud

# re: SharePoint: Custom Field Type for MultiLine text

Hello,

I was facing the issue of the 255 characters limitation and now, it's gone :)

Thanks for the tips !

Emmanuel

Wednesday, October 17, 2007 1:12 AM by Matthew petersen

# re: SharePoint: Custom Field Type for MultiLine text

Serge,

Do you know the 'parenttype' values for the other field types? I have been looking everywhere for a definitive list and cannot find one anywhere. Also, is it possible to create your own custom field type from a custom control instead of a standard sharepoint control?

thanks

Matt

Friday, October 26, 2007 5:25 AM by red_c

# re: SharePoint: Custom Field Type for MultiLine text

hi,

i'm red_c and my proglem is:

"...full qualified class,assembly name"

What's this line. I serched in all internet, and don't understend this.

pleas somebody help my... this is importand for me

Friday, December 21, 2007 8:37 AM by charlie

# re: SharePoint: Custom Field Type for MultiLine text

I'm not seeing the complete picture. I can get my control to be a multiline control, but it still only stores 255 characters in the sharepoint database.

What class do I derive my field from?

SPFieldMultiLineText doesn't fix the 255 problem. SPField doesn't solve the 255 problem either.

Thursday, May 15, 2008 2:19 AM by paul

# re: SharePoint: Custom Field Type for MultiLine text

Hi Serge,

I am having the same problem as Charlie it is multiline but only takes 255 characters.

Am i missing something?

Wednesday, June 11, 2008 12:58 PM by Sam

# re: SharePoint: Custom Field Type for MultiLine text

Did Serge and Charlie happen to solve the 255 character limitation? I'm chasing my tail here also.

Monday, June 23, 2008 7:34 AM by Scott

# re: SharePoint: Custom Field Type for MultiLine text

Guys, you need to define it as a Note Type. e.g

<Field

ID="{}"

Type="Note"

Name="$Resources:names,fred;"

DisplayName="$Resources:names,fred;"

StaticName="$Resources:names,fred;"

Hidden="FALSE"

Required="FALSE"

Sealed="TRUE"

AllowDeletion="FALSE"

/>

Friday, October 03, 2008 5:58 PM by kjk

# re: SharePoint: Custom Field Type for MultiLine text

this does not work.

Friday, October 03, 2008 6:27 PM by kjk

# re: SharePoint: Custom Field Type for MultiLine text

this does not work.

Monday, October 20, 2008 12:56 AM by arunsingh

# re: SharePoint: Custom Field Type for MultiLine text

I did all short of this but invain.

Did field type as as SPMultiLineText...

in XML, parent type is Note

finally SPField type is NoteField....

But still not able to resolve the issue.

Plz suggeest along with this what we have to do.

Thanx in advance,

arun

Thursday, November 13, 2008 5:05 AM by ALex

# re: SharePoint: Custom Field Type for MultiLine text

Hi,

I tried this, however the field still show only 255 characters.

But the Error message is hopefully gone.

Alex

Tuesday, December 16, 2008 1:51 PM by Bala

# re: SharePoint: Custom Field Type for MultiLine text

I am not able to edit any custom fields in MS Word. I can only edit in the SharePoint environment. IS there any way I can edit those fields in MS Word?

Thursday, May 21, 2009 12:42 PM by Senthil

# re: SharePoint: Custom Field Type for MultiLine text

A simple workaround for the issue using Object model

# Inconvenient Content Query Web Part vs. Lookup fields with multiple values - Waldek Mastykarz

Pingback from  Inconvenient Content Query Web Part vs. Lookup fields with multiple values - Waldek Mastykarz

Thursday, July 23, 2009 9:47 AM by jonkman

# re: SharePoint: Custom Field Type for MultiLine text

A bit late maybe, but if someone finds this thread (like me) and wonders what the answer to the 255 chars problem is:

When converting a column from SPFieldText to SPFieldMultiLineText the column does not properly reflect the changes made in the code and in the XML. E.g. it is still not able to store more than 255 characters.

But I created a new DocLib, added my supposed not working custom column, and voilá: it suddenly worked and hold all the content.

Additionally I added a new Field property:

<Field Name="SQLType">ntext</Field>

into the XML definition like suggested by

panvega.wordpress.com/.../field-types

Thursday, November 12, 2009 7:36 AM by Jimmy Thomsen

# re: SharePoint: Custom Field Type for MultiLine text

Hi.

This is actually described on MSDN:

msdn.microsoft.com/.../ms437580.aspx

For note:

Allows users to enter multiple lines of text. This field is not sortable or groupable. All text is defined to be straight ASCII characters without HTML markup. Anything that looks like HTML markup or a URL is simply quoted (for example, Server.HTMLEncode) to look like straight text. The control for editing this format is a simple TEXTAREA block. Use the NumLines attribute to specify the number of lines to display. Corresponds to the ntext SQL data type and represented by the SPFieldMultiLineText class.

For text:

Text   A single line of text entered in an edit box. This field is sortable and groupable. Use the MaxLength attribute to set a maximum number of characters allowed. Corresponds to the nvarchar SQL data type and represented by the SPFieldText class.

Now lookup the limits for ntext and nvarchar.

Leave a Comment

(required) 
(required) 
(optional)
(required)