Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Apps in Microsoft Teams drive collaboration by enabling users to do work where they communicate and collaborate. One way to make your apps collaborative is by adding the ability to have a conversation about your app or the data in your app. Teams is your go-to place to have such conversations.
For example, in the Profile+ sample app template for Teams, when you select one or more profile cards in the app, you can start a chat with the selected people directly in Teams.
You might also want to use this capability for your apps. For example, if you're building a sales opportunity tracker for the sales manager to review upcoming deals, you might want to add a button for the user to chat with the sales person about the opportunity.
This way, Power Apps in Teams can use deep integration with other Teams capabilities to make apps collaborative. In this article, we'll learn how we can integrate Power Apps with Teams to facilitate conversations.
Watch this video to learn how to configure having conversations about business data in Teams app:
To complete this lesson, we'd need the ability to create apps within Teams that will be available as part of select Microsoft 365 subscriptions.
Log in into Teams using either the Desktop app or the web app
In this section, we'll create a new Teams team and then create an app within that team. Skip this section if you already have a team you want to use instead.
To create a new team, select the Teams tab, and then select Join or create a team on the left bottom of the screen.
Select Create Team > From Scratch > Public, give the team a name such as "Calls and Meetings Integration", and select Create.
(Optional) If you have any members in your organization that you'd like to add to the team for testing purposes, select them, and add them in the popup for adding members.
Select Close.
The new team gets created, and is listed under the Teams tab.
We'll create an app where the user can start a conversation for a particular team and Channel by selecting a button and typing in a message in a text box. The user can then select the Submit button to post the message in the particular team and channel in Teams, then other user can join the conversation.
Open Teams.
Select Power Apps from the left-pane.
Select + New app under Recent apps.
Select the team created earlier, and then select Create.
The app gets created and Power Apps Studio opens to allow editing the app.
Enter a name for the app, such as "Conversation app", and select Save.
The app is created with a default gallery on Screen 1.
We need to add Teams as a connector to the app since we want to be able to access the teams and channels from the logged in user’s account.
We need to add a table to maintain a list of companies we'll use as the company record, and to start a conversation about it.
Select Data from the left-pane.
Select + Add data and then create a new table with the name "Company", and plural name as "Companies".
Add a few company names to the table, and then select Close.
Next, we'll add a screen to the app so that users can select the customer that they want to have the conversation about.
In the tree view, select + New screen > select Scenarios tab > select List.
A new screen gets added with a gallery list.
Update the title of the gallery to "Companies List".
Select Companies as the data source for the gallery.
The list of companies that was added shows up in the gallery TemplateGalleryList1.
Delete Screen1 from the tree view, and rename the new screen to Screen1.
We need to add another table to capture the details such as the Teams conversation ID, team, and channel related to a conversation started in the app.
Select Data > + Add data > Create new table.
Enter table name as Conversation and plural name as Conversations.
Change the default Name column name to ID.
Add the following columns to the conversation table:
Column | Type |
---|---|
Team | Text |
Team Channel | Text |
Team Name | Text |
Channel Name | Text |
Company | Lookup, related table= Company |
Save and close the table.
Now, we'll add a new screen where the app user can start or join a conversation.
In the tree view, select + New screen > Blank layout.
Update the Fill property of the screen to something other than white color.
In our example, we've set the Fill property of the screen to RGBA(224, 224, 237, 1)
.
Select + (Insert) > Input > Button.
Update the following properties of the button.
Property | Value |
---|---|
Name | startaconversation_Button |
Text | "Start a conversation" |
Width | 200 |
Height | 32 |
Font size | 12 |
X | Parent.Width/2 - startaconversation_Button.Width/2 |
Y | 100 |
OnSelect | Set(enterMessage,true) |
Select + (Insert) > Input > Combo box.
Update the following properties of the Combo box.
Property | Value |
---|---|
Name | team_Combobox |
Items | MicrosoftTeams.GetAllTeams().value |
Width | 320 |
Height | 32 |
X | Parent.Width/2 - team_ComboBox.Width/2 |
Y | 200 |
Text | "Team" |
Tooltip | "Team" |
Visible | enterMessage |
Add another combo box and update the following properties.
Property | Value |
---|---|
Name | channel_Combobox |
Items | If(!IsBlank(team_ComboBox.Selected.id),MicrosoftTeams.GetChannelsForGroup(team_ComboBox.Selected.id).value) |
Width | 320 |
Height | 32 |
X | Parent.Width/2 - channel_ComboBox.Width/2 |
Y | 200 |
Text | "Channel" |
Tooltip | "Channel" |
Visible | enterMessage |
Select + (Insert) > Input > Text box.
Update the following properties of the Textbox.
Property | Value |
---|---|
Name | message_TextBox |
Value | "" |
Width | 500 |
Height | 180 |
X | Parent.Width/2 - message_TextBox.Width/2 |
Y | 300 |
Placeholder | Type message here |
Visible | enterMessage |
Select + (Insert) > Input > Button.
Update the following properties of the button.
Property | Value |
---|---|
Name | submit_Button |
Value | "Submit" |
Width | 96 |
Height | 32 |
Font size | 12 |
X | Parent.Width/2 - submit_Button.Width/2 |
Y | 500 |
Visible | enterMessage |
Copy the following formula in the OnSelect event of the button.
Patch(Conversations,Defaults(Conversations),{ID:MicrosoftTeams.PostMessageToChannelV3(team_ComboBox.Selected.id,channel_ComboBox.Selected.id,{content:message_TextBox.Value,contentType: "text"},{subject:"New conversation"}).id,Team:team_ComboBox.Selected.id,'Team Channel':channel_ComboBox.Selected.id, 'Team Name':team_ComboBox.Selected.displayName,'Channel Name':channel_ComboBox.Selected.displayName, Company: TemplateGalleryList1.Selected}); Set(enterMessage,false); Reset(team_ComboBox);Reset(channel_ComboBox);Reset(message_TextBox)
Note
Select + (Insert) > Input > Button.
Update the following properties of the button.
Property | Value |
---|---|
Name | joinconversation_Button |
Text | "Join conversation" |
Width | 200 |
Height | 32 |
Font size | 12 |
X | Parent.Width/2 - submit_Button.Width/2 |
Y | 500 |
Visible | enterMessage |
Copy the following formula in the OnSelect event of the button.
Launch(Concatenate("msteams://teams.microsoft.com/l/message/",Last(Sort(Conversations, 'Created On', Ascending)).'Team Channel',"/",Gallery1.Selected.etag,"?tenantId=",Param("tenandId"),"&groupId=",Last(Sort(Conversations, 'Created On', Ascending)).Team,"&parentMessageId=",LookUp(MicrosoftTeams.GetMessagesFromChannel(Last(Sort(Conversations, 'Created On', Ascending)).Team,Last(Sort(Conversations, 'Created On', Ascending)).'Team Channel').value,id = Last(Sort(Conversations, 'Created On', Ascending)).Team).etag,"&teamName=",Last(Sort(Conversations, 'Created On', Ascending)).'Team Name',"&channelName=",Last(Sort(Conversations, 'Created On', Ascending)).'Channel Name'),{},LaunchTarget.New)
Note
Next, we'll update the OnSelect property of the company gallery so that when a user selects a company from the list, the app will go to the second screen.
Select Screen1 from the tree view to open the Companies gallery.
Set the OnSelect property of the gallery item to Navigate(Screen2)
.
Select Save on the top-right to save the app.
Select Publish on the top-right to publish the app.
Select Next.
Under Add to Channel, make sure the channel under which the app should be shown is listed and shows as "1 active tab(s)" and not "0 active tab(s)".
Select Save and Close to complete the publishing of the app.
Run the app in preview mode or go to the team in which the app is created.
The Companies gallery should show up as the first screen.
Select one of the companies.
You should only see two buttons: Start a conversation and Join a conversation.
Select Start a conversation.
Additional fields should show up:
Select a team.
Select a channel within the team.
Enter message.
Select Submit. All the additional fields/controls get hidden.
Select Join conversation to be taken to the team and channel chat where the last message was sent.
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayTraining
Module
Collaborate in teams and channels with Microsoft Teams - Training
Learn how to collaborate in Microsoft Teams through conversations in channels and chats, sharing files, and using Outlook with Teams. Personalize your environment by managing your notification settings and organizing your teams, channels, and chats.
Certification
Microsoft 365 Certified: Teams Administrator Associate - Certifications
Demonstrate skills to plan, deploy, configure, and manage Microsoft Teams to focus on efficient and effective collaboration and communication in a Microsoft 365 environment.