Upgrade the Provider Hosted App using PowerShell in SharePoint 2013

Sathish Nadarajan
Solution Architect
August 25, 2015
Rate this article
[Total: 0    Average: 0/5]

In this article, let us see how to upgrade an App using PowerShell in SharePoint 2013.

Usually it will be very easy, if we remove the app and re-deploy the same app. We may not many issues on this. But the importance of Upgrade will be

· When we have many App Parts and those App Parts were added on Many Pages.

· In this stage, if we Remove the app, then all the app parts will be removed from the Pages.

· When we install, the app parts will not be getting added automatically.

Hence, in this scenario, we require the App Upgrade. Even this is also quiet straight forward. On theAppManifest.xml, we need to increment the Version Number. For example, by default it would be When you are planning for an upgrade, increment it to something like

Then the script would be

 Add-PSSnapin Microsoft.SharePoint.PowerShell
 $site = "http://MySiteCollectionURL"
 $AppName = "MyApp"
 $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
 Set-Location $scriptBase
 write-host $scriptBase
 $appPath = $scriptBase + "\" + "MyApp.app"
 $spapp = Import-SPAppPackage -Path $appPath -Site $Web -Source ObjectModel
 $appInstance = Get-SPAppInstance -Web $Web | where-object {$_.Title -eq $AppName};
 $app = Update-SPAppInstance -Identity $appInstance -App $spapp -Confirm:$false -ErrorAction SilentlyContinue -ErrorVariable err;

The script is straight forward right…

Happy Coding,

Sathish Nadarajan.

Author Info

Sathish Nadarajan
Solution Architect
Rate this article
[Total: 0    Average: 0/5]
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 13+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more

Leave a comment