xmlsharepointxsdspfield

SPField custom attributes in schema


I'm trying to decide whether it is possible to store custom attributes in a SPField's schema XML.

If you look at the .xsd for the 'Field' element in SharePoint, there are a slew of attributes. The last one in the attribute list is <xs:anyAttribute>. This elements purpose is to allow it be extended. This obviously leads me to believe it is possible to store custom attributes. However, I cannot find any documentation on this.

Anyone have any experience with this, or seen documentation saying yay or nay on the subject?


Solution

  • You are right you can have custom Attributes to the SPField,

    <?xml version="1.0" encoding="utf-8" ?>
    <FieldTypes>
      <FieldType>
        <Field Name="Property1">ConfigurableURL</Field>
        <Field Name="Property2">Value2</Field>
        <PropertySchema>
          <Fields>
            <Field Name="CustomAttributeOne" DisplayName="CustomAttributeOneDisplay" Type="Text"></Field>
          </Fields>
        </PropertySchema>
      </FieldType>
    </FieldTypes>
    

    You can find more information about the subject at the below links

    Link1

    Link2

    Link3