Category: O365

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)

How to activate modern pages on a classic team site

Recently I was searching for how to get the new Modern Pages in an old classic team site, which was created a couple of years ago in SharePoint Online.
New modern team sites, Groups and Communication sites are already having the new Modern Pages, but the old ones are still stuck with the old fashioned pages like SP2013.
As I’m missing all the new features and eager to improve our old home page, I went looking for the trigger that defines if SharePoint creates a modern or classic page.

First I have noticed that there was an extra contenttype in the Site Pages library of Modern Team sites. Site Pages is the contenttype which is used to create the new Modern pages.

Screenshot from the Site Pages library on a Communication site

 

 

Adding this contenttype to the old Site Pages library went fine but creating a new page, based on the Site Page contenttype, results in the following error:

 

 

After comparing the activated features of the old team site and the Modern Team site I bumped into the following feature:

 

 

 

And as obvious as the name is, the Site Pages feature will activate the modern pages for the old team sites and let you enjoy all the new functionalities that are provided by the modern pages.

From now on, clicking on “Add a page” will create a modern page:

 

Enjoy!

GiphyBot in Teams

One of the most requested features @Ventigrate is a proper implementation of Giphy in Microsoft Teams. Microsoft did provide a solution to that request but it is not  as user friendly as it is in Slack.

That’s why I developed a Microsoft bot that you can use to get a random gif back by providing a keyword. I published the bot to azure and thanks to the (new) posibility of sideloading bots in Teams, it possible to activate and use it on your own tenant (see “How to install it?)”.

What’s different between Slack, Teams and Giphybot?

In Slack, the implementation of Giphy provides a random gif by typing ‘/Giphy {keyword}’ into a channel. That’s way more quicker and funnier than the implementation of Microsoft in Teams

Microsoft’s implementation requires that you click on the gif icon, provide a keyword and select a specific gif. The akward moment of waiting, of which gif is showing up, is lost and users stop using Giphy in Teams.

The implemention I made gives users the possibility of getting random gifs back by mentioning the bot in a channel: ‘@GiphyBot {keyword}’. The bot will reply with a random gif according to your keyword.

How to install it?

  1. Create a new manifest.json file with the following lines of code [Note: make sure the ID is correct: 231f435f-4d49-47a4-a26f-fc7d6f91cbee]
  2. Zip the manifest.json file
  3. Go to Teams an on the team you wish to load it, click on the overflow (“…”), and select View team..
  4. Select the Bot tab, then click on “Sideload a bot or tab” on the lower right.
  5. Browse to and select your zip package from your PC.
  6. You will see your sideloaded bot or tab in the list.

From now on you can use the bot! Have fun!

 

Please let me know what you think about this bot! And keep following (@Yborghmans) for the next blog post where I explain the development of the GiphyBot.

 

More information about the bot framework: