Share via


PropertySchema Element (Field Types)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Represents the schema of certain special variable properties of a custom field type, with each property defined as a Field element.

<PropertySchema>
</PropertySchema>

Attributes

Attribute

Description

None

Child Elements

Fields Element (Field Types Property Schema)

Parent Elements

FieldType Element (Field Types)

Remarks

Custom field types may have special properties whose value will vary from one column based on the field type to another column based on the same field type. Consider a custom regular expression field type that is designed to hold String values that match a certain regular expression, such as ^(\d{3})\d{3}-\d{4}$ for American telephone numbers. Rather than create separate custom regular expression field types for British license plate numbers, American Social Security numbers, Chinese telephone numbers, etc., it is more efficient to create a single regular expression field type and enable users who create columns based on the field type, to set the regular expression that needs to be matched on a column-by-column basis. For example, a user creating a "US Telephone Number" column would set the column's regular expression to the string above. Another user, creating a "Brazilian Post Box" column would set his column's regular expression to ^\d{5}\-\d{3}$.

To do this, the custom field needs to have a RegularExpression property that is rendered in an editable control on the user interface (UI) when a new column is created. In Windows SharePoint Services 3.0, this is in the Additional Column Settings section on the New Site Column page and the Create Column page. The PropertySchema element in the fldtypes*.xml file is where such variable properties are declared and given a default rendering schema. Optionally, they can also be given default values.

Note

If you define the variable properties of the custom field type in the PropertySchema element, Windows SharePoint Services 3.0 automatically renders those properties based on the schema. You can also define the rendering of your field type properties using a field editor user control. For more information about the advantages of each approach, see Custom Field Type Property Rendering.

Example

The following example defines a property schema for a custom field type called "RegularExpressionMatch." The schema declares a field for use by column creators when they base a column on the field type. The purpose of the field is to enable a column creator to set a different regular expression for each column she bases on the RegularExpressionMatch field type.

The DisplayName and an editable Text field will appear in the Additional Column Settings section on the New Site Column page and the Create Column page. The MaxLength attribute sets the maximum length, in characters, of the regular expression and the DisplaySize sets the size of the field that holds it. Users can scroll within the field to see the rest of the regular expression if it is longer than DisplaySize.

No default has been set in this example, but if the developer of the field type knew that in most cases it would be used to create columns containing American telephone numbers, the developer could set the default as <Default>^(\d{3})\d{3}-\d{4}$</Default>.

Note: The following code example has been edited for clarity.

<FieldType>
  <Field Name="TypeName">RegularExpressionMatch</Field>
  …
  <PropertySchema>
    <Fields>
      <Field Name="RegularExpression" 
             DisplayName="Regular Expression To Match" 
             MaxLength="500" 
             DisplaySize="100" 
             Type="Text">
        <Default></Default>
      </Field>
    </Fields>
  </PropertySchema>
  …
</FieldType>

See Also

Concepts

Custom Field Types

Custom Field Classes

Custom Field Type Property Rendering

Custom Field Type Definition