Short post showing how to use the new actions that have been recently added to the Teams connector - "Create a chat" in Power Apps.
0. Add Teams connector as data source
To use Teams action from Power Apps, add Teams connector from "Data" panel to your app.
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*.
* 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.
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:
Demo : Create a group chat from #PowerApps pic.twitter.com/0GxWNaQ77l
— Hiro (@mofumofu_dance) July 14, 2021