How to create a new Channel in Microsoft Teams through PowerApps
In my last blog, we saw how to post message in channel through PowerApps. In this blog we will see how to create a new Channel in Microsoft Teams through PowerApps. We will add an approval stage before channel creation. Teams owner will approve the channel request and then channel will get created.
Agenda for this blog
- Build a data connection to Microsoft Teams
- Make a screen under Screens
- Create a MS Flow for channel creation and Approval process
Data connection to MS Teams
- Click View -> Data sources
- Add data source -> New Connection -> Select Microsoft Teams
Make a screen under Screens
We will add a screen under the screens tab of our application. Screen shot of my screen is below.
In the above screen, I have added gallery, labels, Text inputs and buttons. How to build the gallery control with “Select Team” button ? Add a gallery control in your screen and write “MicrosoftTeams.GetAllTeams().value” to populate the items in gallery. Insert two labels and one button inside the gallery.
Formula for each control inside the gallery are below.
Label10_1 > Text > ThisItem.displayName
Label11_1 > Text > ThisItem.id –> Hide this control as no need to display.
Button1_1 > OnSelect > Select(Parent)
Gallery 4_1 > TemplateFill > If(ThisItem.IsSelected, YellowGreen, White)
Pardon my naming convention of the controls 🙂 . Hope you guys will do it properly whenever creating an application.
Rest controls are just used as it is in the screen. Create Channel button is invoking a MS Flow. If you don’t know how to do this. Please go through this link. Formula for Create Channel Button is CreateChannel.Run(Gallery4_1.Selected.id,TextInput2.Text,TextInput2_1.Text).
Create a MS Flow for channel creation and Approval process
Now we will create the MS Flow for approval process followed by channel creation. Follow the below steps to create this Flow.
- Insert a new step and add Approvals
- Select Start and wait for an approval
3. Follow below screen to set up approvals step
4. Add condition step and set outcome (from approvals step) is equal to “Approve“
5. Under “If Yes” add Create a channel from Microsoft Teams data connector.
6. I am stopping the flow when condition is “If No”. You can send an email to the user/initiator if you want. See below screen shot for detailed configuration. For more information on approval flow please click on the link.
After performing the above steps we created one request via powerapps as shown below.
An email will be triggered to approver for approval process. Once Approval approves the request a new channel will created under the selected teams as shown below.
Hope you liked this post. If so then please share it & subscribe to our site to receive future blog update. Also you can drop us an email to email@example.com for any queries related to powerapps, ms flow & other Microsoft technologies. We will be happy to assist you.