I have been using SetCustomProperty in a recent project. The way that it was implemented was to create a new Field Type and inherit from SPField.
A custom field type xml field type was then created and stored in 12HIVE\TEMPLATES\XML\fldtypes_[projectname].xml and a property schema was described in this xml file for the field type:-
<PropertySchema>
<Fields>
<Field Name="MultiImageMaxNoImages"
DisplayName="Maximum Number of Images"
MaxLength="1"
Type="Number">
<Default>4</Default>
</Field>
<Field Name="MultiImageMaxSize"
DisplayName="Maximum Size of Image (Kb)"
MaxLength="5"
Type="Number">
<Default>1024</Default>
</Field>
</Fields>
</PropertySchema>
I then created a couple of public properties in the SPField class which would use the following to save field properties.
/// <summary>
/// The maximum number of images that can be stored in the field.
/// </summary>
public int MaxImages
{
get
{
int maxImages = 4;
Int32.TryParse(GetCustomProperty(Providers.MultiImageFieldProvider.Properties.MaxNumberOfImages).ToString(),out maxImages);
return maxImages;
}
set
{
int maxImages = value;
SetCustomProperty(Providers.MultiImageFieldProvider.Properties.MaxNumberOfImages,maxImages);
}
}
The Providers.MultiImageFieldProvider is just a static helper class:
/// <summary>
/// Provider for common SharePoint fields and functions.
/// </summary>
public static class MultiImageFieldProvider
{
/// <summary>
/// Properties class contains internal names of extra custom properties
/// </summary>
public static class Properties
{
// Custom Properties
public const string MaxNumberOfImages = "MultiImageMaxNoImages";
public const string MaxSize = "MultiImageMaxSize";
}
}