Upgrade the Provider Hosted App using PowerShell in SharePoint 2013

Sathish Nadarajan
SharePoint MVP
Published On :   25 Aug 2015
Visit Count
Today :  1    Total :   8117
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!

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.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

Migratiin Tools for SharePoint