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: https://powerapps.microsoft.com/en-us/blog/add-your-canvas-apps-to-teams/

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: https://graph.microsoft.com/v1.0/me/
TeamID you want to test this with: https://graph.microsoft.com/v1.0/me/joinedTeams
Retrieve all channels (ChannelID of the one you choose) of a team: https://graph.microsoft.com/v1.0/teams/{team-id}/channels
All installed applications (once you have added the application to Teams, note you need to grant some permissions for this one ): https://graph.microsoft.com/beta/appCatalogs/teamsApps

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: https://docs.microsoft.com/en-us/powershell/module/skype/set-csteamsappsetuppolicy?view=skype-ps

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 https://graph.microsoft.com/v1.0/teams/{TeamID}/channels/{channelID}/tabs

{
   "displayName": "PowerApps as App tab",
   "teamsApp@odata.bind" : "https://graph.microsoft.com/beta/appCatalogs/teamsApps/{applicationID}",
   "configuration": {
   	"entityId": "/providers/Microsoft.PowerApps/apps/{PowerAppsID}",
        "contentUrl": "https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/{PowerAppsID}?source=teamstab&locale={locale}",
        "websiteUrl": "https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/{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. https://docs.microsoft.com/en-us/graph/api/user-add-teamsappinstallation?view=graph-rest-beta&tabs=http

Vastaa

Täytä tietosi alle tai klikkaa kuvaketta kirjautuaksesi sisään:

WordPress.com-logo

Olet kommentoimassa WordPress.com -tilin nimissä. Log Out /  Muuta )

Google photo

Olet kommentoimassa Google -tilin nimissä. Log Out /  Muuta )

Twitter-kuva

Olet kommentoimassa Twitter -tilin nimissä. Log Out /  Muuta )

Facebook-kuva

Olet kommentoimassa Facebook -tilin nimissä. Log Out /  Muuta )

Muodostetaan yhteyttä palveluun %s

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