Set custom properties for a custom field type in a content type function

I created a custom field type (derived from SPFieldText) and added the custom property "MyProperty". Now, what I'm looking for, I need to use this field type in my Content Type function.

How can I specify my custom property in a content type definition file, just like what we do with OOB field types?

I saw a workaround here , but it only solves the XSD check problem. The site string is set correctly, but the value that I specified in this function is not set for the column after the function is installed.

thanks in advance

Arun

+5
source share
3

Smth,

<Field ID="{aec8cea1-d0df-49fc-baef-d356e58423f4}" Name="ClientWorkspace" DisplayName="$Resources:Nervogrid.Lauxtermann.Root,FieldWorkspaceDisplayName;" Type="ExtendedWorkspace" Group="$Resources:Nervogrid.Lauxtermann.Root,GroupLauxtermannFields;" AllowDuplicateValues="FALSE">
    <Customization>
      <ArrayOfProperty>
        <Property>
          <Name>SiteTemplates</Name>
          <Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">;#12203;#</Value>
        </Property>
        <Property>
          <Name>HideOnDisplayForm</Name>
          <Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_no;</Value>
        </Property>
        <Property>
          <Name>HideOnEditForm</Name>
          <Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_yes;</Value>
        </Property>
      </ArrayOfProperty>
    </Customization>
  </Field>
+1

     <Field ID="{EB4A62A3-5722-4D12-9AB8-BB36461D8E5D}" Type="MyCustomFieldType" Name="Website" DisplayName="Website" StaticName="Website" Required="true">
        <Customization>
          <ArrayOfProperty>
            <Property>
              <Name>MyFirstProperty</Name>
              <Value>www.stackoverflow.com</Value>
            </Property>
            <Property>
              <Name>MySecondProperty</Name>
              <Value>stackoverflow</Value>
            </Property>
          </ArrayOfProperty>
        </Customization>
      </Field>

:

string myFieldValue = ((XmlNode[])this.GetCustomProperty("MyFirstProperty"))[0].Value;
+1

All Articles