Tuesday, 23 December 2014

Upgrade a SharePoint App after list field modification by its build version


It was quite challenging to upgrade  an app by its build version if some changes are made in the list structure.

Suppose I have an app which creates two lists(ListA,ListB) when it is deployed to a site collection. Now, I have deleted two columns in ListA and after some changes I would like to upgrade the app in that site collection.

Let me tell you, it will not allow you to upgrade that and after a while it will generate an error "taking too long time."

To solve this, you have to write your changes in Feature1.Template.xml as below:

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Version="1.0.0.4">
  <UpgradeActions
    <VersionRange BeginVersion="1.0.0.3" >
      <ApplyElementManifests>
        <ElementManifest Location="PLinksInstance\Elements.xml" />
        <ElementManifest Location="PLinks\Elements.xml" />
        <ElementManifest Location="UserPLinkSettingsInstance\Elements.xml" />
        <ElementManifest Location="UserPLinkSettings\Elements.xml" />
      </ApplyElementManifests>
    </VersionRange>
  </UpgradeActions>

</Feature>

And Obviously you need to change the permission at AppManifest.xml as shown below:



Now Rebuild the project and publish to get the app package(.app file) and try to upgrade the app in "Apps In Testing" in the Site Contents of the site collection.

Hopefully, it will successfully upgrade the app.

No comments:

Post a Comment