How to develop Microsoft Teams

Microsoft Teams

A few months ago, Microsoft added the ability to push contextual information from a host team or channel into a Microsoft Power Apps. This is a big improvement for citizen developers building apps to be used in a Microsoft Teams context. Before designing their apps, developers can now clarify where the app will be hosted, how big it will be, what client type and design it will have, and much more. 

One of the challenges developers can face when developing applications is getting Teams contextual information during development and testing time. While the context-sensitive parameters are available within Teams, this data is absent outside of Teams. One way to work around this issue is to check where the app is loading from and respond accordingly. To do this, proceed as follows.

Locate the source

The easiest way to tell if the app is being launched from Teams or not is to look at the source parameter that’s being passed. This can take on one of four values:

Based on the respective value, we can then decide how to deal with the specific case.

Use variables to store parameter values

If we store the parameter values in variables, we can just refer to them without worrying about how we got them. We can use the following expression in OnStart()  to know how to proceed:

Set(source, Param(“source”));

If(source = “team staff”,

Set(selectedTeam, Param(“teamId”));

Set(selectedChannel, Param(“channelId”));

Defining Microsoft Teams runtime parameters

During the development phase, developers must test their app with all possible input combinations to ensure that it behaves as expected. We can extend the example above to not only determine if the app was launched within Microsoft Teams but also to allow the developer to choose specific input parameters to test the app’s behavior.

I typically set up a  debug area in my app that is only visible under certain circumstances. In this scenario, I used the same source parameter to set whether the panel should be visible or not. So the  OnStart() expression looks like this:

Set(source, Param(“source”));

Set(debug, If(source <> “teamstab”, true,false));

ClearCollect(groups, MicrosoftTeams.GetAllTeams().value);

// Preload the channel and team if the data is there

If(source = “team staff”,



Set(selectedChannel,LookUp(channels,id = Param(“channelId”)));

In this scenario, I enable debug mode when the  source is not teamstab (i.e. within teams). Then, instead of just setting the selected group and selected channel variables as IDs, I use the Microsoft Teams connector to get the team and channel information.

The panel itself differs depending on the use case of the app. But usually, I would give the user the option to select a team or channel and make other settings.

Test your app

If you are satisfied with the solution and want to test it, you can start a test run in the browser after your app has been published. All you have to do is change the source to the teams tab and append the parameters to the URL in the browser. In my case, I only use the team and channel. So I just need to append the  groupId  and  channeled  :{appid}?tenantId={tenantid}&source=teamstab&groupId={groupId} &channelId={channelId}

(NOTE: Don’t let the Microsoft Teams connector confuse you. The  GetTeam() action requires you to specify the groupId, not the teamId).

Once you’ve deployed an app to Microsoft Teams, any published updates will appear once the app has reloaded in a tab. While this can simplify the testing process for a new app, it’s not ideal if you want to test changes to an app that’s already released and actively used.


Developing Teams-compatible apps bridges the gap in deciding whether to develop them with Power Apps or other development platforms like Node. This approach allows app developers to make changes and test an app before deploying it to Teams. This reduces the number of development, deployment, testing, and troubleshooting cycles required.

For more on Microsoft Power Apps, we at Al Rafay Consulting would love to answer any queries and questions and are open to professional advice on this topic. We are a team of professionally committed developer and would love to you assist you in any solutions regarding Microsoft Power Apps, so feel encouraged to contact us.

You May Also Like

About the Author: John Vick

Leave a Reply

Your email address will not be published. Required fields are marked *