Adding PowerApps as Teams application to Teams via Graph API

You may already be aware that you can export a PowerApps to Teams. In case you haven’t heard about this part check this URL:

However, the real interest is in what we can do with PowerApps once we have uploaded the application to Teams App Catalog.

You need to figure out, before progressing, a few IDs:

UserID you want to test with. Find yourself:
TeamID you want to test this with:
Retrieve all channels (ChannelID of the one you choose) of a team:{team-id}/channels
All installed applications (once you have added the application to Teams, note you need to grant some permissions for this one ):

Adding PowerApps application to user

Using quite simple Graph API commands you can add application to specific users. Of course you can do this with Application policies as well, but if you think about automated management and provisioning a API is always a API.

Using POST command to /users/{userID}/teamwork/installedApps we can add an application to user’s personal apps (ie: left rail apps). The payload contains the application ID. And. That’s it. The application appears in user’s apps. No, it is not pinned in the left – but soon(ish) there will be a feature that allows user’s to do it manually – or using PowerShell:

Adding PowerApps to teams as tabs

This has been available manually (add PowerApps tab) for a long time. And I did some testing how to use GRAPH API to add a PowerApps as teams tab earlier – almost a year ago. This version required you to add PowerApps as a tab first manually and then reverse engineer the tab configuration code before applying it to other teams. However with PowerApps as applications it is a lot easier!

First. Open the Teams PowerApps zip file and open the manifest.json file. From there you will need to grab a few things to clipboard and prepare to do a bit of manual editing. The section you need is called “staticTabs”. From there you need to take the entityID and Name (if you wish). And application ID you had earlier already.

Then you can format your JSON payload content and call{TeamID}/channels/{channelID}/tabs

   "displayName": "PowerApps as App tab",
   "teamsApp@odata.bind" : "{applicationID}",
   "configuration": {
   	"entityId": "/providers/Microsoft.PowerApps/apps/{PowerAppsID}",
        "contentUrl": "{PowerAppsID}?source=teamstab&locale={locale}",
        "websiteUrl": "{PowerAppsID}?source=teamsopenwebsite"

And looking at the team we can see the tab appearing.

Now, that can be repeated to every new team in provisioning, for example. And if there are changes you can just update the Teams application with a new version number and it will be be updated in every team. So yes, this is a lot easier than it used to be a year ago.

After this, it would be just the matter of adding the desired applications to management & provisioning processes.

As usual, Docs.Microsoft.Com provides a great resource for Graph API calls and some examples.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.