3

Content types cannot be updated declaratively. In other words, if a content type is a part of solution package, deploying new version of the content type will not make any changes to existing content type which has already been deployed. This is documented on MSDN:

You cannot add columns to an existing site content type declaratively, in other words, by updating the Feature XML files.

Are there any other SharePoint artifacts (such as lists, site columns, etc.) which cannot be updated declaratively?

0

Even though Microsoft says it isn't possible in the link you provided above. I was able to update a content type and add another column to it using declarative using XML Sandbox Feature solutions.

You have to create an UpgradeAction manifest file, and include the AddContentTypeField within the UpgradeAction.

https://msdn.microsoft.com/en-us/library/office/ff595314.aspx

 <UpgradeActions>
   <VersionRange BeginVersion="0.0.0.0" EndVersion="1.9.9.9">
     <ApplyElementManifests>
        <ElementManifest Location="CO_Source\Elements.xml"/>
        <ElementManifest Location="CA_Css\Elements.xml"/>
        <ElementManifest Location="Assets\Elements.xml"/>
     </ApplyElementManifests>
     <AddContentTypeField ContentTypeId="0x0101004A6AC4D7159D498DBDF17D3C10D609A0" FieldId="{b952f5fd-8490-49f6-8b02-cdf4cfc03a99}" PushDown="TRUE"/>
   </VersionRange>
 </UpgradeActions>

As long as you version your sandbox solution correctly, and apply the UpgradeActions right, you will be able to add a field to a content type.

A walk through example with code can be found here. https://cann0nf0dder.wordpress.com/2014/08/21/upgrading-sandbox-solutions-in-sharepoint

However, I would recommend nowadays, to use PNP provisioning to upgrade and don't use feature provisioning at all anymore.

  • I intend migrate from feature framework to code provisioning for content types. I am concerned about other SP artifacts. It would be too much work to switch everything to code provisioning. – Slaven Semper Aug 21 '17 at 14:09
  • If you used get-pnpprovisioningtemplate with pnp powershell on the site, that should grab a lot of the provisioning for you. Although i do understand its not just that simple, and will need to understand what you need to change/add/remove before applying somewhere else. Heavily customised site would require a lot of work. (Dont forget to mark my answer if it was right) – Cann0nF0dder Aug 23 '17 at 18:43
0

To answer your original question, you cannot declaratively update a list or site column that you created declaratively. You'd either make the change directly in the UI, or use an upgrade feature receiver to make those changes.

As the other responder mentioned, you can add fields to an existing content type declaratively via a feature upgrade. Feature upgrades can be extremely powerful, especially given the ability to write a feature receiver that will allow you to code almost any kind of update, but this ends up increasing the complexity of your solution, and also still requires manually invoking the upgrade action after your WSP has been updated on the farm.

If you're interested in learning more about feature receivers, here's a link to the details on MSDN: https://msdn.microsoft.com/en-us/library/office/ff595308.aspx

I also agree that PnP Remote Provisioning is a simpler way to go, since it decouples your content from your solution, and eliminates the dependencies between them.

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.