Microsoft PowerApps helps business/teams in building quick
OOB apps. This post helps understanding, how to get access to Microsoft Teams data from PowerApps using custom connectors.
Why there is a need for custom connector? Microsoft has
introduced lot of connectors on PowerApps interface to get access to the data.
The Office 365 connectors included in Microsoft PowerApps are office 365 users,
mails, etc. The custom connectors are created for the data, which is not
exposed as connectors readily. The custom connectors are common for both Flow
and PowerApps.
We are leveraging Microsoft Graph API as data sources for this app, and to be connected as custom connectors on Microsoft PowerApps.
The following snapshot shows the end result, showing data from MS Teams on MS PowerApps using MS Graph API.
Demo App to Show MS Teams Data
Let us look at step by step approach for achieving the functionality.
The objective of this article is to demonstrate the power of Microsoft services available to create survey/quiz and automate processes without using any code.
Let us first create a quiz/survey on Microsoft Form, and publish it on Microsoft Teams. Login to Microsoft Forms and create a new quiz with appropriate points. Click on Share to get the response link to the created quiz. This link is posted on Microsoft Teams to get responses (This is explained at the later point of this article).
As we are marching towards the transition phase from Skype to Microsoft Teams, let us look how you could enable/advice users to adopt to new technology early. The article helps you understand how you could automate the process of identifying users who are not of Microsoft Teams system, and sending them reminders to adopt to the latest technology. The approach explained here is one way of identifying and enabling users to adopt to Teams sooner. There are multiple ways to enable such adoptions.
Scenario
Let us first see how technically you could identify users and notify users on the usage. For this process, we will leverage Azure Logic Apps to create automated flows to identify the user pattern (usage and reports). The usage reports will be available on the Office 365 user activity reports. To access and manipulate the user patterns, we could leverage Microsoft Graph with necessary permissions.
As an example, we will consider logged in date as a parameter for this process. We will initially analyse the Microsoft team’s usage statistics on Office 365 report center and look for user logged in activity. If there are no activity present for any user, we will trigger an automated email for earlier adoption. Let us create a flow to achieve the entire process.
The below picture depicts the high level flow. In the below section, we will see each and every action in detail.
Azure Logic Apps Flow - To Identify Users not using Teams and Send Automated Mails
The channels creation could be automated with the help of Microsoft Flow actions, and that is without writing any custom code. Microsoft Teams itself could be leveraged as medium for necessary user approvals.
As the Skype is sooner going to be replaced with Microsoft Teams, the necessary processes should be setup wherever required to ease the user and admin relationships.
Why do you need to setup such process? Let us consider a scenario, where your organization needs a process to create and setup channels in your Microsoft Teams tenant. Giving permissions for users/groups to create channels will end up with so much of test groups created. Instead, an approval process could be set to automate this process, to get necessary approvals for creating channels.
Configured Components
The implementation idea is going to very simple, with SharePoint and Microsoft Flow being used to automate this process. The following tools are being used for this demonstration.
Microsoft Teams – Medium where this logic being applied
SharePoint list - an intermediate store for holding new channel registration information.
Microsoft Flow – Configured steps to automate,
Send out necessary notifications to admins for approvals
Based on approval decisions, create the necessary channels under respective team
Send out an notification on channel creation
SharePoint/Teams Configuration
Set up the preliminary steps on SharePoint, for storing the requests.
Setup a SharePoint list to get input of channel details form users. The input could be team name and channel name.
Configure the list on any of the default teams channel tab.
The overall process is depicted in this picture.
Automate the Channel Creation Process - with no-code steps
In my previous post, you would have seen posting the items
into Microsoft Teams Channels as conversations using Microsoft Flows. The respective
channels will be chosen by selecting the Teams service in the flow
configurations.
In this post, let us try to achieve similar kind of
functionality, but with a little different approach. As we are all aware that
Microsoft Teams will support incoming webhook requests, let us try configuring the
webhook URLs.
Webhook:
What is webhook? The external system which posts messages
whenever data is available using the endpoint APIs.
How the webhook will help in Microsoft Teams? Take for an
example, you are using Teams as a collaboration platform. You need to post data
from multiple systems to the team channels for better collaboration. The
webhook URL can be generated for a channel and can be shared with other
external systems. Whenever the external system has the data for posting, the
data will be sent to the teams using the API generated.
Let us see how to work with Microsoft teams from SharePoint programmatically using Graph APIs.
Microsoft has provided the Graph APIs to work with Microsoft
Teams and its channels. Though, it is in a beta version. The graph APIs can be
triggered from any of the portals. Here, let us only look
at triggering the graph APIs from the SharePoint portals.
For example, the following graph API is used to get all the
teams which you are part of.
https://graph.microsoft.com/beta/me/joinedTeams
Application with Microsoft Teams Permissions
First, you need to register the application in Microsoft dev
portal, where you need to provide the necessary permissions for accessing the
Microsoft Teams data from any portal.
Login to the Microsoft applications portal https://apps.dev.microsoft.com
Provide the name
Copy the Application ID generated. (It will be used as
client ID in the SharePoint code in the below section)
Add the platform as web and then provide the redirect URL.
In our sample, you need to provide the SharePoint page URL you will be using to
test the functionality.
In the Microsoft Graph Permissions, add User.ReadWrite.All and
Group.ReadWrite.All permissions to the both the permissions (delegated and
applications permissions).
Then save and close the application.
Navigate to the SharePoint page, where you want to test the
functionality. Add a content editor web part with jquery script reference.
Acquire Access Token and Hit Microsoft Teams Graph API
Access Token to be acquired for getting the Microsoft Teams
data. The request token will be generated by redirect URL. The redirect URL to
be built with the help of authentication server URL, domain details, response type,
client ID (generated above), resource URL (Graph API URL) and redirect URI
(SharePoint Page where the functionality is tested). In the following script
file, required logic to get the access token is written.
Once the page is redirected, the access token will be
available in the redirected URL. We need to extract the token and the ajax call
is made to the graph API using the access token.
Create a custom JavaScript file (teams.js) with the script content available in the below section.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Posting SharePoint Items as Conversations in Microsoft Teams
Here let us see how to push the items from SharePoint into
the Microsoft Teams Channels as conversations using Microsoft Flows. #MicrosoftTeams #MicrosoftFlow
This is simple, straight forward and out of the box
approach. Microsoft Flow eases our job with out of the box configuration.
Consider a business scenario, whenever an item is created in
the SharePoint repository, it has to be pushed into Microsoft Team’s channel
for discussions. The following steps will helps you in configuring the flow out
of the box.
Note: Assuming, the connections for teams and SharePoint
services are being available in the Microsoft Flow portal. If not already
created, you will be prompted to provide the account details when configuring
the SharePoint or the Microsoft Teams components in the below steps. You can provide different or
the same account details. The accounts to the SharePoint or Microsoft teams can
also be configured on the Microsoft Flows portal by navigating to the connections
component.
Steps Involved:
Create a list in the SharePoint site.
Create a channel in the Microsoft teams.
Login to the Microsoft flows.
Select the SharePoint service à "when an item is
created" template.
Provide the site details and list
details.
Click on New Step à Add an action option.
Search
for Microsoft teams and select it.
Select
Post Message option.
From the
drop down select the Microsoft Teams ID, Channel ID, and Message to be posted.
Here,
message to be posted can be customized. Click on the message text box and
select the SharePoint item field by adding dynamic content. (picture shown
below)
Save the flow.
Test the Flow:
Login to the SharePoint site and navigate to the list.
Create an Item à
Provide some data and save it.
Login to the Microsoft Teams and navigate to the channel
provided in the configuration.
You can see the item created in the SharePoint list, posted
as a conversation in the Team’s channel.