Adding a new Field Type
I thought I would make this entry about creating custom field types. I always forget how to do this since i’m not actively creating many types so I figured this is the best thing to do….as a reference.
Taken from the “Professional SharePoint 2007 Development” book (WROX), let’s do the following:
STEP 1: Creating a new FieldType
1. Create a new VS Class Library (Windows Project) in C# (you can use VB also)
2. Name the project “RYL_CustomFieldType” (or whatever you prefer)
3. Add a reference to “System.Web”
4. Add a reference to “Microsoft.SharePoint” (found in the %HIVE%\Bin on your SharePoint server)
5. Rename the “Class1.cs” file to “SocialSecurityNumber.cs”
6. Add a “public” modifier to the SocialSecurityNumber class if not already done.
7. Add “using” statements for both “Microsoft.SharePoint” and “System.Text.RegularExpressions”
8. Edit the class declaration to inherit from “SPFieldText”
