Month: November 2017

Install & Uninstall SharePoint apps by code announced at ESPC 2017

Today at ESPC 2017, Vesa Juvonen announced the availability of an endpoint on SharePoint Online to install, uninstall, deploy, retract, upgrade, and remove SharePoint apps programatically.
As I was thrilled by the announcement, I immedialty tested it out on my development environment with this blogpost as result (for the items I could test by myself).

So, wich information do we get from the endpoint, which actions can we execute?

Get apps

First of all, the endpoint itself looks like: _api/web/tenantcatalog
Using that endpoint (GET) will provide the following result:

The bold ID is the identifier which we have to you to execute the other actions like install, uninstall…

Other properties are also returned like:

  • AppCatalogVersion: showing the version of you app in the appcatalog (so not the installed version).
  • CanUpgrade: true or false, depending if you can upgrade you app to the latest version.
  • Deployed: if the app is deployed on the current site for where you are executing the call.
  • InstalleVersion: the current installed version of the app, can be lower than the appcatalogversion.
  • IsClientSideSlution: if the application is a SPFx solution.
  • Title: the title of the application.

 

POST actions

The following actions gives you the posibility to perform some usefull actions with your app and your app package at sites and at the app catalog.
As you can notice, the add-command isn’t described below. That’s for the simple reason I can’t get it working. For that call I have to wait for the official documentation of Microsoft, so it is clear which body has to provided to add an app to the app catalog.

Update (18/11/2017): The official documentation is out and can be found (together with the PNP Powershell cmdlets) at: Application Lifecycle Management (ALM) APIs

Install app

To install an app, you have to use the following endpoint: _api/web/tenantappcatalog/AvailableApps/GetByID({id})/Install
Where {id} has to be replaced with guid’27a768cb-89fc-45ba-939c-6ac4cf617f7a’
Providing the correct X-RequestDigist header will result in an ‘200 – OK – response’, and the app will be installed

Result (200 – OK):

Uninstall app

Pretty much the same as installing an app, but instead of /install, you have to use (so obvious) /uninstall.

Result (200 – OK):

Upgrade app

If there is a newer version in the appcatalog available for your specific app, you can use this action to upgrade to app to the latest version (and again the same as with install and uninstall):

Result (200 – OK):

Remove, retract, deploy

For remove, retract,  and deploy you have to go to the app catalog site collection (there were the app packaged where added).
First you have to retract the app from your tenant by the following action/command:

To redeploy the app to your tenant you can use

To entirely remove the app from the app catalog you can use the following action/command:

 

Start your MS Flow from within the new SharePoint column formatter

At Ignite, Microsoft announced the new column formatter for SharePoint online. It provides the flexibility to format your columns based on your data.

SharePoint list with three columns formatted
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

Lincoln DeMaris (BRK3252) explained how the formatting worked with a lot of useful demos. One of them was a button/link in a column that launches an MS Flow for that specific item in your list. Unfortunately, the docs.microsoft.com article does not provides the JSON yet, but you can copy paste it from here. The only thing you have to do is to create an MS flow, copy paste the GUID, and give it a relevant name in the JSON. If you want to format the column, you can take a look at the documentation of Microsoft on: Get started with column formatting (docs.microsoft.com)

 

Important note: The flow has to be able to start on it’s own. This means that the trigger for the flow has to be for example the “For the selected item”-trigger of the SharePoint repository. Otherwise the panel on the right won’t show up and the console logging will show you that the flow can’t be executed.

And example of a working flow:

 

Extra information:

Use column formatting to customize SharePoint (docs.microsoft.com)

Geek out with the product team on SharePoint lists and libraries (Youtube)