I was wondering if anyone here has any experience with updating the schema.xml file after deployment. I have a solution that I will outline in this post, but I feel like it is a delicately balanced hack instead of a real solution. Any Information that you can provide is greatly appreciated!
To begin, I am trying to create a new taxonomy site column, use this new site column in place of an old one in an existing content type, and update the list definition (and all existing lists) to show the new site column instead of the old.
The content type was originally deployed via an elements.xml file. From what I understand, once deployed this file should never be modified. So, via code I define my new site column, add the site column to the content type, and delete the old
site column from the content type. I perform an update(true) on the content type so that the change is pushed to all list instances. At this point, I can go to any list and the new/edit form for each of those lists does not show the old site column
but does show the new. So far so good!
There are two problems at this point. If I try to create a new list from the definition, I get a list that contains the site column that I deleted AND the new site column. Also, the deleted site column name still appears in the default view.
I tried removing the old and adding my new site column to the schema.xml, but this breaks all existing lists that were made from this schema.xml (specifically, it is a taxonomy field and none of the taxonomy fields work after updating). I can create a new list from the list definition that works fine, but I still need existing lists to work.
The solution that I ended up on was JUST removing the no-longer-necessary field from the schema.xml, and then adding my new field to the ViewFields list in the schema.xml. If I do this, everything is happy even though the only mention of the new field
in the schema.xml is in the ViewFields section.
So, with all of that said... does this make sense? Am I doing this the correct way, or does this just work for now... and it will blow up later?
Thanks in advance!