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

https://sharepoint.com/_layouts/15/appstore.aspx?AppInstanceId=<AppInstanceId>

 Use below script to uninstall the App in SharePoint Online.


[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

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)

   $appInst.Uninstall()

   $context.ExecuteQuery()

 }

$UserName = "rahul.dagar@sharepoint.com"

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

$Url = "https://App.sharepoint.com"

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

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

Uninstall-AppInstance -Context $context -AppInstanceId $AppInstanceid

$context.Dispose()

Also you can check below script
https://gallery.technet.microsoft.com/office/Uninstall-unwanted-app-f18b39c0 

Hope it helps:)

Happy SharePointing :)

Thursday 9 March 2017

Install and Uninstall SharePoint 2013 Apps using PowerShell.


This post will discuss how to install and uninstall the Apps in SharePoint 2013 On-Premise. I will create another post which will cover SharePoint Online.

So lets get started :)

Installing of Apps in SharePoint 2013


First thing we need to do is to import the app package file to our site collection.

Powershell to import it.


$App = Import-SPAppPackage -Path "C:\Rahul\App.app" -Site "http://Sharepoint2013" –Source ObjectModel

Source: can be Marketplace or CorporateCatalog, DeveloperSite, ObjectModel etc.
 
Now, we will install the app in site
 
Install-SPApp -Web http://Sharepoint2013/site -Identity $App

So Powershell script to install will be like:

$App = Import-SPAppPackage -Path "C:\Rahul\App.app" -Site "http://Sharepoint2013" –Source ObjectModel
Install-SPApp -Web http://Sharepoint2013/site -Identity $App
 

Uninstalling of Apps in SharePoint 2013 


For Uninstalling any app first we need to app from the site and after that we can uninstall it.

So Powershell script to uninstall will be like: 

$installapp = Get-SPAppInstance -web http://Sharepoint2013/site | Where-Object { $_.Title -eq "App" }
Uninstall-SPAppInstance -Identity $installapp 

Hope it helps:)

Happy SharePointing :)






 


 


Monday 6 March 2017

Create Site Collection 2010 experience in SharePoint 2013 - Part 2

 In previous post we create Site Collection 2010 experience in SharePoint 2013 using GUI below is the link for that Post

1st Method GUI

In this post we will shed some light on 2nd Method which is PowerShell.

So lets get started.

Below is the Powershell cmd which will help to create the Site collection with 2010 look and feel in SharePoint 2013

New-SPSite -Url "http://sp-test:6001/sites/test1" -OwnerAlias "SPFarm" -CompatibilityLevel "14" -ContentDatabase "WSS_Content_Support_6001" -Template "STS#0"



Compatibility level will choose your experience if you write 15 then it will pick 2013 look and feel.

Template i used is Team site. You can choose according to your requirement. Below is the link with template code

List of Template in SharePoint  

My site collection is created with 2010 experience in SharePoint 2013

Hope it helps:)

Happy SharePointing :)

Create Site Collection 2010 experience in SharePoint 2013


One of our users comes with request. Can we have site collection with a Look and Feel like SharePoint 2010 in 2013.

So in order to achieve the above request we have two way to do both very simple and straight forward.

1st using GUI and 2nd using Power-Shell

So lets start with 1st method using GUI.

Steps:

1. Open Central Admin ---> Application management --> Create new site collection.





2. New window will open, select the web application under which you want to create a new site collection.

3. Fill in the required details like title,description, url etc and in Template selection drop down select 2010 and click OK



4. It will take sometime to create a new site collection but once down and when browse to the site collection. You can see that you site collection has a look and feel of 2010.





In other post we will use the 2nd method to create a site collection using 2010 look and feel.

Hope it helps:)

Happy SharePointing :)