I am using Visual Studio to create a state workflow. As part of my solution I am creating a custom Document Library template. The template includes the required custom content type and some custom columns.

It seems that if I want to change the column properties (as part of the development process), I need to make the change in many different files. For example, if I want to add the ShowInEditorForm attribute I need to update the following:

  1. The Elements.xml file for the Site Column
  2. The Elements.xml file for the Content Type
  3. The Schema.xml file for the List Template (in two places) -- once in the <FieldRefs> attribute and then again in the <Fields> attribute

Am I doing this correctly? Why are the attributes repeated over and over? Why can't I just define the default properties once and then have them used when referenced?

Edit -- Updated Findings

As far as I can tell, it looks like that at any point in the "chain" the properties can be overwritten. It also looks like, up to a certain point, the properties do not have to be repeated.

With that said, I was able to reduce the Elements.xml file for the Content Type down to the following

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Parent ContentType: Document (0x0101) -->
    <ContentType ID="0x010100E28D2FB8531146D582E6FC3729433EFF"
            <FieldRef ID="{f41f6d8e-ca33-4867-af14-adedba9b0eb1}"
                      Name="KnowledgeBaseArticleStatus" />
            <FieldRef ID="{48235e6d-92d7-4c9e-94ef-24054c81fb83}"
                      Name="KnowledgeBaseTechnicalReviewBy" />

I still need both the ID and Name but I can leave the rest of the attributes out. And it seems that I still must have the attributes repeated in the Schema.xml file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.