0

In my solution, I have defined a custom Field and Content Type. The field is defined as follows

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{5f4f08ad-7f5b-4d5d-879c-50b417acae3d}"
    Name="TaskActionComment"
    StaticName="TaskComment"
    DisplayName="Comment"
    Type="Note"
    RichText="TRUE"
    RichTextMode="FullHtml"
    Required="FALSE"
    Group="Knowledge Base Article Columns">
  </Field>
</Elements>

And the Content Type is defined as follows

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Workflow Task (0x010801) -->
  <ContentType ID="0x010801003EE4B5580C5846B6BE74BFC41A663388"
    Name="Technical Review Task"
    ...
    Inherits="FALSE"
    Version="0">
    <FieldRefs>
      ...
      <FieldRef ID="{5f4f08ad-7f5b-4d5d-879c-50b417acae3d}"
      Name="ActionComment" />
    </FieldRefs>
    <XmlDocuments>
      ...
    </XmlDocuments>
  </ContentType>
</Elements>

When I use the UI to confirm the definitions after deployment, the field looks correct.

enter image description here

But when I add the Content Type to my Tasks list and go look at the column definition for the list I get

enter image description here

What am I doing wrong?

2
  • The field XML looks good.. Can you try to delete the delete the content type and column, and then redeploy your solution? – Arsalan Adam Khatri Apr 10 '14 at 19:20
  • @ArsalanAdamKhatri -- I had already tried re-deploying and even rebooted the system in-between deployments. I found the solution and posted it. – Jason Apr 10 '14 at 19:58
1

I figured it out. It looks like it was a SharePoint "retention" issue. It seems that retracting a solution does not truly remove everything.

Using SharePoint Manager 2013, I was able to see that the Comment field was still defined in the List even though the Content Types were removed from the List and the solution was retracted. In addition, when the solution gets re-deployed, SharePoint sees that the column already exists in the List and uses that previous definition instead of the defined attributes in the solution.

Go figure...

4
  • 1
    Yes retracting doesn't mean removing the Site Columns where they are used.. It's good between in case of Production site which has live data.. :) – Arsalan Adam Khatri Apr 10 '14 at 20:05
  • I understand that...and it makes sense. But that should only apply if the list that "uses" it actually has any data in it. In my case, the list was empty. (And yes...both recycle bins were empty.) From a development stand-point, this makes it very, very difficult to code up my solution if I need to manually go in and delete each column after retracting it. – Jason Apr 10 '14 at 20:08
  • 1
    True, most of the time on Feature Deactivation.. I write code to delete the columns from the List as well :) Of course, remove this in Production.. – Arsalan Adam Khatri Apr 10 '14 at 20:15
  • 1
    Ahhh. I see. In my case I moved the list instance creation and content type additions to existing lists, from the SP solution to a PowerShell script. So I deploy from VS and then run my "Set Up" script. I also have a corresponding "Tear Down" script that is run before Retracting. I guess I need to add the Column removal to the "Tear Down" script too. Thank you. – Jason Apr 10 '14 at 20:21
0

You refer to your custom field "TaskActionComment" as simply "ActionComment" in the content type definition. Amend the content type reference to the field to "TaskActionComment" and test again. Hope that's it!

1
  • Matching the name did not help. I found the solution and posted it. – Jason Apr 10 '14 at 19:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.