The custom SharePoint 2013 solution has the following features, activated in this order:
- The site-scoped Feature "Fields" installs three "number" fields: Operator1, Operator2, Total
- The site-scoped Feature "BaseContentTypes" installs the "Operation" content type that collects these three fields
- The site-scoped Feature "ContentTypes" installs the content types "Sum" and "Sub" that inherit from the content type "Operation"
- The web-scoped Feature "ListInstances" installs a custom list instance and also binds the content types "Sum" and "Sub"
Here's the definition files:
Fields/Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field Required="TRUE" Type="Number" DisplayName="Operator1" Name="Operator1" ID="{7461e368-052d-47b4-a9f5-670f8855aeee}"> </Field>
<Field Required="TRUE" Type="Number" DisplayName="Operator2" Name="Operator2" ID="{6a640f57-e93c-4520-a357-09fc43ab0bd8}"> </Field>
<Field Required="FALSE" Type="Number" DisplayName="Total" Name="Total" ID="{ebfc38a1-8cd4-4fb4-9cbf-95f9f958101d}"> </Field>
</Elements>
ContentTypes/Operation/Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType Inherits="True" Version="0" Name="Operation" ID="0x0100e8d98355ead640608400a77e3988129e">
<FieldRefs>
<FieldRef Name="Operator1" ID="{7461e368-052d-47b4-a9f5-670f8855aeee}"/>
<FieldRef Name="Operator2" ID="{6a640f57-e93c-4520-a357-09fc43ab0bd8}"/>
<FieldRef Name="Total" ID="{ebfc38a1-8cd4-4fb4-9cbf-95f9f958101d}"/>
</FieldRefs>
</ContentType>
</Elements>
ContentTypes/Sum/Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType Inherits="True" Version="0" Name="Sum" ID="0x0100e8d98355ead640608400a77e3988129e01">
<FieldRefs></FieldRefs>
</ContentType>
</Elements>
ContentTypes/Sub/Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType Inherits="True" Version="0" Name="Sub" ID="0x0100e8d98355ead640608400a77e3988129e02">
<FieldRefs></FieldRefs>
</ContentType>
</Elements>
ListInstances/Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance OnQuickLaunch="TRUE" FeatureId="00bfea71-de22-43b2-a848-c05709900100" TemplateType="100" Url="Lists/MyList" Title="MyList">
</ListInstance>
<ContentTypeBinding ListUrl="Lists/MyList" ContentTypeId="0x0100e8d98355ead640608400a77e3988129e01"/>
<ContentTypeBinding ListUrl="Lists/MyList" ContentTypeId="0x0100e8d98355ead640608400a77e3988129e02"/>
</Elements>
The incorrect result I have is that the "MyList" list will have the expected content Types "Sum" and "Sub", however in the New and Edit form I will see the fields:
- Title (required)
- Operator1
- Operator2
- Operator1 (repeated, this time not editable, I will only see the label
- Operator2 (repeated, this time not editable, I will only see the label
- I will not see the expected field "Total"
Trying to modify the default view, I will only see the fields "Operator1" and "Operator2", once each. I will not see the field "Total".
If I use the UI to unbind the content types "Sum" and "Sub" from the list, and then again with the UI bind the same site content types, I will have the correct result in the New and Edit Form:
- Title (required)
- Operator1
- Operator2
- Total
Does anybody know why it's behaving incorrectly when the binding between the list and the content types is done with the feature?