Infrastructure

Designing SharePoint WSPs from Visual Studio: Trick 2 (Keep your ContentType elements.xml comments at the bottom)

I had an interesting experience while commenting out certain columns from being included when deploying my content type elements.xml files.  For instance, if I commented out one particular FieldRef like so:

      <FieldRef

       ID="00000009-dae4-4c99-98b0-d5c300dffb99"

       Name="PolicyProcedureID"

       Description="Policy/Procedure ID"

       DisplayName="Policy Procedure ID"

       ReadOnly="FALSE"

       ShowInNewForm="TRUE"

       ShowInEditForm="TRUE"

         />

 

      <!–

       <FieldRef

       ID="00000222-dae4-4c99-98b0-d5c300dff222"

       Name="Reviewers"

       Description="Users given permission on this item for review workflows"

       DisplayName="Reviewers"

       ReadOnly="FALSE"

       ShowInNewForm="TRUE"

       ShowInEditForm="TRUE"

         />

 

–>

      <FieldRef

        ID="{00000021-dae4-4c99-98b0-d5c300dffb21}"

        Name="Approvers"

        Description="Users given permissions to this item for approval workflows"

        DisplayName="Approvers"

        ReadOnly="FALSE"

        ShowInNewForm="TRUE"

        ShowInEditForm="TRUE"

         />

 

The approvers column disappeared in addition to my Reviewers column that I wanted to be commented out.  At first I didn’t care, because I was just testing different iterations of a lookup column and then once I removed the comments, viola! the Approvers column reappeared.

So, the lesson or tick here is, that if you want to add comments to a Content Type definition elements.xml file, place them at the bottom.  If you are testing out a few different columns and want to keep some commented out, always keep the commented ones at the bottom.

Leave a Reply