DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

SP Field Types with more than 255 Characters

Posted by PANVEGA on November 13, 2007


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.


Your base class Inherits from SPFieldMultiLineText. We are only creating a singleline field, but the SPFieldText base class maps to an nvarchar(255) in the content database.  This would limit the amount of plain text that could be entered to well less than 255.  By using the SPFieldMultiLineText base class, our field is mapped to an ntext in the database.

To limit the user from entering more than 255 characters, we use the MaxLength property on the TextBox in the user control.

To solve this issue you have to do the following steps:

1.  Change the ParentType from Text to Note in you fldtypes_custom.xml file

<Field Name=”TypeName”>MyPeoplePicker</Field>
<Field Name=”ParentType”>Note</Field>
<Field Name=”TypeDisplayName”>Custom PeoplePicker</Field>
<Field Name=”TypeShortDescription”>Custom PeoplePicker</Field>

Represents whether this field type is displayed for inclusion on lists.

The possible values are exactly the same as the possible values for the Type attribute of the Field Element (List – Definition) element. If the field type is not derived from another type, then the value is an empty string:

2. That the real tricky thing, change the SQLType Field in the fldtypes_custom.xml from

<Field Name=”SQLType”>nvarchar</Field>

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

Optional String. Represents the SQL data type that will be used to store the data in the content database.

However you do not use a <Field Name=”SQLType”> element in your custom field type definitions.

3.  Change the inherits in your base class from SPFieldText to SPFieldMultiLineText

That it, now you see more than 255 Charactres in your Custom Field Type

Read more:


3 Responses to “SP Field Types with more than 255 Characters”

  1. skurocks said

    A simple workaround for the above issue using Object model

  2. skurocks said

    A simple workaround for the above issue using Object model

  3. PANVEGA said

    Thanks, that is a nice approach when the ObjectModel with UnlimitedLengthInDocumentLibrary attribute!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: