Issue

When you install the K2 for SharePoint app in an upgraded K2 environment after removing a  previous version of it, the following error occurs:

Sorry, something went wrong. A different version of this App is already installed with the same version number. You need to delete the app from the site and the site recycle bin to install this version.

Image

Cause

When you removed the previous version of the K2 for SharePoint ap, the SharePoint App framework failed to remove the app from the App Catalog. When you try to install the new version, the error occurs. 

Workaround

To ensure the old K2 for SharePoint app is removed from your environment, follow the steps below:

SharePoint On-Premises

  1. Open your App Catalog site and open the Site Contents page.
  2. Select the K2 for SharePoint app, click ... then ... again and select Remove.
    Image
    This can take up to 5 minutes for the timer job to complete.
  3. To complete the timer job immediately, run the follwing PowerShell command:
    Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue $spJob = (Get-SPTimerJob | where-object{$_.Title -eq "Internal App State Update"}) Enable-SPTimerJob $spJob | Out-Null Start-SPTimerJob $spJob | Out-Null
  1. Open your App Catalog site.
  2. Navigate to Site Settings > Users and Permissions > Site app permissions.
  3. Click the X for any K2 apps.
    Image
  1. Open your App Catalog site.
  2. Navigate to the Apps for SharePoint page.
  3. Delete all K2 apps.
    IImage
  1. Open your App Catalog site.
  2. Navigate to Site Settings > Site Collection Administration > Recycle Bin.
  3. Select all K2 apps and click Delete Selection.
    Image
  4. Navigate to the second-state recycle bin.
  5. Select all K2 apps and click Delete Selection.Image

If the issue persists on your SharePoint on-premises environment, contact Microsoft Support to help remove the application. Or you can run the following SQL commands to force the application remnants to be removed, allowing you to install the correct version of the application.

This SQL script is provided as-is. Any modification of SharePoint databases is done at your own risk and should not be done without first making a backup.

DECLARE @PackageFingerprint binary(64), @SiteId uniqueidentifier
 
SELECT @PackageFingerprint = [PackageFingerprint], @SiteId = [SiteId]
FROM [WSS_Portal].[dbo].[AppPackages]
WHERE ProductId = 'B34691DA-746E-444C-A80D-AABB5D152851'
 
EXEC [WSS_Portal].[dbo].proc_App_InvalidatePackage
@PackageFingerprint, @SiteId
 
EXEC [WSS_Portal].[dbo].proc_App_DeleteInvalidatedDownloadApp
@PackageFingerprint, @SiteId

Once the script succesfully executes, reinstall the K2 for SharePoint app using the Adding the App topic in the User Guide.

SharePoint Online

In addition to running the steps for SharePoint on-premises, you can also run the following PowerShell command to try to remove any remnants of the K2 Cloud for SharePoint app.

Install-Module AzureAD
Install-Module MSOnline
Connect-MsolService
$clientId = "3308eaff-d056-4a32-9b1d-563f81bf06f9"
$appPrincipal = Get-MsolServicePrincipal -ServicePrincipalName $clientId
Remove-MsolServicePrincipal -ObjectId $appPrincipal.ObjectId

If the issue persists on your SharePoint Online environment, you must contact Microsoft Support to remove the application.

If successful, reinstall the K2 Cloud for SharePoint app as per the following Adding the App topic in the User Guide.

Additional Resources