Friday, 17 March 2017

Uninstalling app in SharePoint Online

This post will guide you on how to uninstall app in SharePoint Online.
For installing any app you can install it from SharePoint APP Store.

So lets get started :)

We have one and only pre-requisite for this that you must have SharePoint Online Client Components SDK installed on the system.

Now we have to get the APP instance ID. Follow below steps to get the ID.

1. Go to the site collection where app is installed
2. Go to Site setting and click a link for an App > Click Details menu item.
3. Now from URL we can get the instance ID<AppInstanceId>

 Use below script to uninstall the App in SharePoint Online.



Function Get-ClientContext([string]$Url,[string]$UserName,[string]$Password)

{   $context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)

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


Function Uninstall-AppInstance([Microsoft.SharePoint.Client.ClientContext]$Context,[Guid]$AppInstanceId)

{   $appInst = $Context.Web.GetAppInstanceById($AppInstanceId)




$UserName = ""

$Password=Read-Host -Prompt "Password" -AsSecureString;

$Url = ""

$AppInstanceid = New-Object Guid("APP INSTANCE ID")

$context = Get-ClientContext -Url $Url -UserName $UserName -Password $Password

Uninstall-AppInstance -Context $context -AppInstanceId $AppInstanceid


Also you can check below script 

Hope it helps:)

Happy SharePointing :)

No comments:

Post a Comment