Friday, 6 December 2019

Identifying Microsoft Teams and the Classic SharePoint Team Site associations with Office 365 Groups: View on PowerApps

Views
Let us see how to create a simple dashboard to identify if Office 365 group has been associated with Microsoft Teams and SharePoint modern team sites.

Office 365 Groups are created with various aspects. Microsoft Teams and Modern SharePoint team sites are created with/from Office 365 groups. Office 365 group is an object on Azure active directory, which will basically a collection of users.

PLEASE NOTE: Every Team created on Microsoft Teams, should have Team Site created and associated. This article only demonstrates the group and teams association, or group and sites association. The site which is not created manually/separately using group is not considered as association here, in this requirement/scenario.

To get the simple view for business users, Power Apps could be leveraged with custom connectors. There are other ways to achieve the same functionality like staging data on SharePoint with power automate and then representing the information on client apps, but I use the simple and straight forward to achieve the requirement.


Microsoft Graph API - Identify group associations


Office 365 groups data is exposed via Microsoft Graph APIs. The key parameters to be leveraged in the Graph API for this use case will be,
  • Group display Name 
  • ResourceProvisioningOptions - if MS team is created for the group, this property will have a value “Team” 
  • CreationOptions – If modern team site has been created with the group, this property will have a value “SPSiteLanguage:1033” 

The following snapshot shows the graph API response showing if the group has Microsoft Teams and SharePoint modern team site associations.
MS Graph API - representing the associations
MS Graph API - representing the associations

To represent this information as dash board on PowerApps, we could leverage the custom connectors concept.


Creating Custom Connectors 


I have already detailed on creating custom connectors on Power Automate before, which could be followed for creating connectors for Microsoft graph API. Creating Office 365 SharePoint Custom Connectors on Microsoft Flow

Here let us quickly look how to create necessary actions for getting office 365 groups information using graph API.
  • In the Power Apps platform, navigate to the custom connector available or create a custom connector if not available, using the steps explained in the article listed above. 
  • In the definition tab of custom connector, create a new action. Provide the summary, description and operation ID.  The following snapshot shows the basic details for the custom action. 
Custom Action - for connecting graph API
Custom Action - for connecting graph API
  • Then provide the request details, by importing the sample operation. Click on import from sample button. Provide the graph API URL for retrieving the group data with get operation.  Then select import as shown below. 
Configuring request details on custom connector
Configuring request details on custom connector

  • Then in the response section, select add default response and provide the JSON data, retrieved using Microsoft graph API of office 365 group list using Microsoft graph explorer. https://developer.microsoft.com/en-us/graph/graph-explorer#. Then click on import as show below. 
Configuring response section on custom connector
Configuring response section on custom connector

  • Once action is created on custom connector, validate and test connection. 


Configuring Data Source on Power Apps 


Create a new app on Power Apps platform with blank template. In the created app, navigate to view -> data sources. Search for your custom connector and double click on it to add to the app.
Custom Connector associated with Power Apps screen to pull the graph data
Custom Connector associated with Power Apps screen to pull the graph data

Insert a screen with following elements
  • Header rectangle icon, holding the header values including for group name, MS Teams enabled, and Site enabled. 
  • Gallery containing label for group name, two icons (check icons) to represent if the corresponding feature is enabled.  

Configure the values on gallery element on the screen.
  • Items property of gallery to contain the office 365 group list. The following snapshot shows the value of gallery Items property. 
Gallery - Items property configured to list down all Office 365 groups
Gallery - Items property configured to list down all Office 365 groups

  • Label inside the gallery to have the group name. I.e., ThisItem.displayName 
  • Tick icon will be shown if Microsoft teams has been associated with the group. Each group item in graph API has a property to identify if team has been provisioned for the group. The property is  resourceProvisioningOptions. This could be used in the visible property of icon to see if the property contains “Team” value. The following snapshot shows the same. 
Teams Association icon - visible property configured to show if there is MS teams association
Teams Association icon - visible property configured to show if there is MS teams association 

  • Another tick icon will be shown if SharePoint team site has been associated with the group. Each group item in graph API has a property to identify if site has been provisioned for the group. The property is  creationOptions. This could be used in the visible property of icon to see if the property contains “SPSiteLanguage:1033” value. The following piece represents the visible property value for site association icon. 
!IsBlank(LookUp(ThisItem.creationOptions,Value = "SPSiteLanguage:1033").Value) 


Publish/Play


Publish the app and check for the results showing Office 365 groups list with team/site association information.
Running App on Power Apps - to represent Microsoft Teams/ Team Site associations with office 365 groups
Running App on Power Apps - to represent Microsoft Teams/ Team Site associations with office 365 groups
PLEASE NOTE: Every Team created on Microsoft Teams, should have Team Site created and associated. This article only demonstrates the group and teams association, or group and sites association. The site which is not created manually/separately using group is not considered as association here, in this requirement/scenario. Simply, site created by default during MSTeam creation is not listed here.