Dataverse for Teams has enabled lots of new possibilities how to use Power Apps with Microsoft Teams. When a new Power App (canvas) is created to a team then it gets the Teams object/ component that can be used to retrieve information like “in which team and channel this app is in”. And yes – this works also in Private Channels!
That is the key to retrieving lots of other information that can be used automatically. The first one is of course the Teams Theme: you can make your application Teams mode aware. Automatically.
I covered ThisMeeting in my earlier blog post, so let’s take a look more about the scenario where the app is added to team channel as a tab. But first – I want to start with Teams.Theme.Name:
In this Fill-part Teams.Theme.Name tells what is the name of theme currently used in Teams. If theme is switched the app can react instantly to that. These are just like Power Fx (or more commonly Excel formulas) that are recalculated instantly. In this example it is not in the dark mode.
Of course you want to extend this to text color too.
Quite awesome – and quite easy to add!
In those screenshots can be seen that there has been several information that was retrieved from the team and channel where the app was in
- Team ID, DisplayName and GroupID (GUID) can be found via Teams.ThisTeam. For example Teams.ThisTeam.DisplayName
- Channel, ID and Kind name follow the same format Teams.ThisChannel.DisplayName. Of course it is nice to know that the channel is “Regular”.. or Private.
And yes – it is possible to add Power Apps to Private Channels as tabs.
Then when you have stored in the Team’s GroupID you can also fetch the Microsoft Team -object to that particular team to open more options. I created to this app similar structure as to meeting aware app : Splash screen is opened first, there is a timer for a second and when timer ends information is retrieved. This gives the app time to load and fill in the information.
In that part I get the team ID as GUID and then get Team information to a variable by calling MicrosoftTeams.GetTeam with GroupID parameter. This information can be then reused in the actual application screen (named companion in this example) – to retrieve team’s GIF settings for example. Yes – that is of course the first thing to get! 😁
But that is just a bit of what that Microsoft Teams Connector can really do. Check out more from Docs!
That is the same functionality that can be found from Power Automate Microsoft Teams Connector. That one allows you to easily
- Posting messages or adaptive cards to team channel
- Creating a new team or managing it’s members
- Creating a team meeting
- Listing teams & channels
In addition you can use Param(“userTeamRole”) and Param(“hostClientType”) to retrieve information about the user role in the team – is that person a owner (0) or a member (1). You can also use it to determine if user is using the application via Desktop, web or mobile Teams.
When you know the device user is using you can then use that information to show user the right screen that is tailored to desktop/web or mobile use.
In the example I created the application that would be used to contact IT. Adding a ticket to IT adds it to IT team’s planner with information about the originating team and channel attached into it. In more real life use case the team and channel information can be used to automatically show right data in the right context.
That is the big thing: Power Apps can have context automatically. When the team and channel is known then backend can support automatic attaching the application to the right customer, project, cost center, business unit etc.. Making a smart application can feel like a natural extension to Microsoft Teams.