MoreBeerMorePower

Power Platform中心だけど、ノーコード/ローコード系を書いてます。

Create a Teams chat from Power Apps

f:id:mofumofu_dance:20210714180735p:plain

Short post showing how to use the new actions that have been recently added to the Teams connector - "Create a chat" in Power Apps.

f:id:mofumofu_dance:20210714165050p:plain

0. Add Teams connector as data source

To use Teams action from Power Apps, add Teams connector from "Data" panel to your app.

f:id:mofumofu_dance:20210714165942p:plain

Once the connection has been added to app, you can set Teams actions on buttons and/or icons.

Input "MicrosoftTeams. " in formula bar for OnSelect property, it will suggest available actions*.

f:id:mofumofu_dance:20210714170345p:plain

* Not all actions are supported for execution in Power Apps.

1. Input parameters for "Create a chat" action

"Create a chat" action requires two input parameters - chat members and chat subject.

f:id:mofumofu_dance:20210714171215p:plain

Chat members are set to a string of UPNs joined by a semicolon , but note that there is no semicolon at the end of the string, which will return error.

  • OK : user1@example.com;user2@example.com

  • NG : user1@example.com;user2@example.com;

[Updated 2021/07/15] Thanks for feedback, Brian Dang

In Power Apps, "Concat" is often used to create a string from a user list, for this case, set the delimiter character in third argument;

Concat(Table, Column, ";")

Also, please note that user does not need to add oneself, because chat is created by user who execute the action.

2. Open chat with Launch function

The result of the action gives the ID of the group chat. To open created chat from Power Apps, you can use "Launch" function like following formula;

Launch("https://teams.microsoft.com/_#/conversations/" & chatID & "?ctx=chat")

where "chatID" is obtained by action output MicrosoftTeams.CreateChat(...).id.

Below is demo to create chat with users selected in ComboBox and launch chat: