Saturday 21 December 2019

Microsoft Teams List (Part I) – Exploring MS Graph API to find the Teams membership information on Office 365 Groups

In the Microsoft teams, there is a way to find public teams, and also private teams if discovery option is enabled on the tenant wide settings.

But is it possible to see all teams irrespective of discovery option on the Microsoft teams tenant? Answer is yes, there is a way for administrators with Microsoft graph API, and building some app interfaces showing the teams list with the help of graph API.

To create the necessary interface showing the teams list,
  • In this article, let us see how to identify the teams membership information with graph APIs. Let us see how to extract all teams list under a tenant using Office 365 groups data, and to extract my teams list. This data will help us drive to build an interface to list down teams and enable options to join a team if user is not a member.
  • In the next article, let us create a simple app on Power Apps to show users about the teams list, with options showing membership and join button if user is not member of the team. - http://www.techwithnakkeeran.com/2019/12/microsoft-teams-list-part-ii-building.html


Use MS Graph API to user relationship with a Team 


Let us quickly see how to find if you want to find the your team membership via Microsoft graph API.
  • Login to Microsoft graph explorer with your administrator rights. https://developer.microsoft.com/en-us/graph/graph-explorer 
  • With major version of graph API (v1.0), you will be able to identify the groups which has teams association. Note this lists down all Office 365 groups without teams filter, you will have to manually find the groups which has only teams association, using resourceProvisioningOptions parameter. https://graph.microsoft.com/v1.0/groups?$select=displayName,id,resourceProvisioningOptions 
List all Office 365 Groups without any filter - showing Group Name and team associate property
List all Office 365 Groups without any filter - showing Group Name and team associate property

  • But, let us use beta version of API to filter and identify the groups which has team association. https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&$select=displayName
List Office 365 Groups, which has only teams association - showing Team Names
List Office 365 Groups, which has only teams association - showing Team Names

  • Now you have identified all teams from the tenant. You have to now find out the teams, you are member of. 
  • Again, the joined teams information could be findable via Microsoft Graph API. The below API helps you to identify the groups you have joined. https://graph.microsoft.com/v1.0/me/joinedTeams?$select=displayName
List Teams which user is member of - showing Team Names
List Teams which user is member of - showing Team Names


Analysis


We have seen, 
  • to get all teams under the tenant using Office 365 groups
  • to get my teams (user already joined a team)

With this information, it will be easy for us to identify which teams user is not part of. Let us see how to list down all teams, and enable options for users to join if he/she is not part of respective team.

Next article, let us create a simple app on Power Apps to show users about the teams list, with options showing membership and join button if user is not member of the team - http://www.techwithnakkeeran.com/2019/12/microsoft-teams-list-part-ii-building.html