Upgrade SharePoint Sandbox Solution

There are certain scenarios where we have to deploy the sandbox solution again with new functionality (like new column in list). Since existing solution already stores crucial data, then retracting the previous version of solution will result in losing of existing data.

Let say, you have sandbox solution which is already deployed on production with version 1.0.0.0. Now you have to made some changes in list schema of the same solution. To do that, follow these steps to make changes in solution so that upgradation works well:
  1. Make changes in your list like add new column and save it.
  2. Open feature which is linked with list.
  3. Click on “Manifest” option. Expand Edit options.
  4. Replace with the below content, change ListName with you list Name and save it. Here I am upgrading the list in which I have added one more column.
    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <Feature xmlns=”http://schemas.microsoft.com/sharepoint/“>
    <UpgradeActions>
    <VersionRange BeginVersion=”0.0.0.0″ EndVersion=”1.9.9.9″>
    <ApplyElementManifests>
    <ElementManifest Location=”ListName\Elements.xml” />
    </ApplyElementManifests>
    </VersionRange>
    </UpgradeActions>
    </Feature>
  5. Now open properties of same feature (press F4 when you are at feature window). There you will find Version property. Currently it is blank and you have put there any version which lies within 0.0.0.0 to 1.9.9.9
  6. Let say I am putting 1.1.0.0 and save it.
  7. Publish the solution and create wsp package.
  8. Rename the wsp package because existing solution with same name is already present.
  9. Now open Sharepoint management shell with admin account.
  10. Execute below powershell commands to add and upgrade the new solution
    1. Add-SPUserSolution -Site <sitecollectionURL> -LiteralPath <full path of sandbox solution wsp>
    2. Update-SPUserSolution -Identity <existingSolutionName> -Site $workspaceUrl -ToSolution <newSolutionName>
  11. Go to list settings and you will find new column.

Note : Follow above steps in case you have to update content type. Changes will be done at step 4 where you have to use AddContentTypeField instead of ApplyElementManifests

For more details, please follow read below articles:

Advertisements

3 thoughts on “Upgrade SharePoint Sandbox Solution

  1. It is applicable only when you have created your list manually. Then creating columns manually is no such harm. But if you are creating those lists via visual studio, then upgrading the solution is the best approach.
    For multiple lists, try add them in one or two feaures, so that you have to modify minimum manifest files. This is only applicable for lists you are modifying. No need to add entries for unmodified lists. See below :

    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <Feature xmlns=”http://schemas.microsoft.com/sharepoint/“>
    <UpgradeActions>
    <VersionRange BeginVersion=”0.0.0.0″ EndVersion=”1.9.9.9″>
    <ApplyElementManifests>
    <ElementManifest Location=”ListName1\Elements.xml” />
    <ElementManifest Location=”ListName2\Elements.xml” />
    <ElementManifest Location=”ListName3\Elements.xml” />
    </ApplyElementManifests>
    </VersionRange>
    </UpgradeActions>
    </Feature>
    

    Like

  2. But for one list , We can add it manually, and If there are 10 lists then we have to change the manifest 10 times. Then how it is going to help us

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s