Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PropertySchema Element (Field Types)

Important note Important

This topic describes markup that was used in an obsolete method of rendering custom field type properties. It is provided solely to assist with the debugging of custom field type properties developed against earlier versions of SharePoint Foundation. For information about the recommended method, Custom Field Type Property Rendering.

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

<PropertySchema>
</PropertySchema>

Attribute

Description

None

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 SharePoint Foundation, 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 Note

If you define the variable properties of the custom field type in the PropertySchema element, SharePoint Foundation automatically renders those properties based on the schema.

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>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.