SharePoint Online - PnP PowerShell - Remove Installed Apps

Daniel Chee 276 Reputation points
2023-03-23T01:38:13.5433333+00:00

Hi MS Q&A,

Have been attempting to report on available Apps deployed / installed against a SharePoint Online Site Collections via the following PowerShell operations to help with subsequent removal / uninstall:

$web = Get-PnPWeb –Includes AppTiles
$appTiles = $web.AppTiles | ? { $_.AppType -eq "Instance" }  

The main intention was attempting to locate instances of following Apps and conduct removal:

  1. Nintex Workflow for Office 365
  2. Nintex Forms for Office 365

Unfortunately, have been unsuccessful with attempts with App removal via Remove-PnPApp and Uninstall-PnPApp cmdlet against the App ID obtained from the prior AppTiles object review attempt.

The following was the encountered error message against each above cmdlet attempted:

{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.ResourceNotFoundException","message":{"lang":"en-US","value":"Exception of type 'Microsoft.SharePoint.Client.ResourceNotFoundException' was thrown."}}}

Seeking any advice if there are any alternative ways to remove the App via PnP PowerShell.

Appreciate any advice and information.

Thank you.

Microsoft 365 and Office SharePoint For business Windows
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-03-23T07:16:05.4566667+00:00

    Hi @Daniel Chee

    Per my research, there is no such pnp powershell cmdlet to delete Nintex Workflow for Office 365. And I feel regretful to inform you that it turns out to be a by-design one. For Nintex Workflow, I will recommend you to raise a new ticket in Nintex Community. This is a dedicated forum to discuss issues about Nintex Workflow. You might get some more professional advice there.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Alan Silverman 1 Reputation point
    2024-04-05T20:28:39.0166667+00:00

    I was able to get this working, not with PMP, but with CSOM. The site https://clavinfernandes.wordpress.com/2022/08/16/remove-app-instances-from-a-sharepoint-site-using-powershell/ provided a good starting point for the solution.

    From Clavin's solution, I was able to extract the ProductID's for the 2 Nintex apps (353e0dc9-57f5-40da-ae3f-380cd5385ab9,5d3d5c89-3c4c-4b46-ac2c-86095ea300c7). Then using the call $Ctx.Web.GetAppInstancesByProductId($productId), I was able to find the apps within each site and successfully perform the removal.

    #Setup Credentials to connect

    $Cred = Get-Credential

    $SiteURL = "<Sharepoint Site>"

    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)

    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

    $productIDs = "353e0dc9-57f5-40da-ae3f-380cd5385ab9","5d3d5c89-3c4c-4b46-ac2c-86095ea300c7"

    foreach ($productID in $productIDs) {

    $App = $Ctx.Web.GetAppInstancesByProductId($productId)

    $Ctx.Load($App)

    $Ctx.ExecuteQuery()

    if ($app.count -eq 1) {

    #Uninstall App Instance

    write-host "trying to remove: " $app.title

    Try {

    $App.Uninstall()

    $Ctx.ExecuteQuery()

    }

    Catch {

    write-host -f Red "Error:" $_.Exception.Message

    }

    } else {

    write-host "Not found " $productID

    }

    }


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.