Showing posts with label GraphAPI. Show all posts
Showing posts with label GraphAPI. Show all posts

Wednesday 13 May 2020

Provision Private Channels on Microsoft Teams with Tabs

Let us understand how to auto-provision a private channel on Microsoft Teams, along with necessary tabs added on the private channel in an automated way.

Article: Private channel provisioning along with necessary tabs could automated with the help of Power Automate flow and Microsoft Graph API. Microsoft Graph API provides us the beta/major version of the graph endpoints to achieve the provisioning solution. Power Automate flow is configured with necessary HTTP requests for provisioning and automate the process.

The solution requires two major steps.
  • Creating Private Channel
  • Adding Tabs


Create Private Channel on Microsoft Teams 


At the time of writing this article, private channel creation endpoint is not available with major version (v1.0). Major version of graph endpoint, provides option to create a channel, but not private channels.
POST https://graph.microsoft.com/v1.0/teams/{id}/channels
Content-type: application/json
{ "displayName": "Architecture Discussion", "description": "This channel is where we debate all future architecture plans" } 

The beta version of graph endpoint, provides option to create a private channel. The endpoint requires a payload to define the nature of channel and to add members with their roles. The following snapshot from Power Automate shows the way to create a private channel, with a member and their role.
Create a private channel
Create a private channel

Saturday 18 April 2020

Configure Azure AD end-user Authentication and Office 365 data access on Azure Health BOT Service via Graph API

Microsoft Health BOT Service is hosted on Azure, and is easily configurable solution that might meet multiple health-related BOT scenarios.

The scenario considered here in this article, helps us to understand how to enable end-user authentication on BOT Service to read Office 365 relevant data. For this POC, Azure AD authentication is considered. Azure AD authentication is best, only when the BOT service provider/organization manages their users entirely on Azure AD. If not the identity and authentication to be changed accordingly.

So in this article, let us understand how to enable end-user authentication on Azure Health BOT service using Azure AD, and read user profile information using Microsoft Graph API.


Enable Azure AD Authentication Flow using Azure AD App configuration


Create an application on Azure AD, and configure the following.
  • Set the required API permissions. In my case, only User.Read under Microsoft Graph delegated type.
  • Set oauth2AllowImplicitFlow to true, under Manifest section or platform configuration section.
  • Under platform configurations, configure the redirect URI (https://bot-api-eu.healthbot.microsoft.com/bot/redirect/oauth2) for health BOT service authentication. 
  • Generate the secret key from certificates & secrets. (Dem81hW@h:Ia07Os/kQEzk-Cr48_SuLm)

Copy the client ID and client secret from this app, to be used in the next sections on Azure Health BOT service configurations.


Configure Azure AD Authentication on Health BOT service


From the health BOT service (https://eu.healthbot.microsoft.com/account/<account-id>), navigate to integration -> authentication.

Authorization URL: https://login.microsoftonline.com/<tenantname>.onmicrosoft.com/oauth2/v2.0/authorize
Access Token URL:  https://login.microsoftonline.com/<tenantname>.onmicrosoft.com/oauth2/v2.0/token

Add new authentication provider with the configurations below.
Azure AAD Authentication configured from the configurations done on Azure AD App
Azure AAD Authentication configured from the configurations done on Azure AD App

Saturday 21 March 2020

Azure Web App – Integrate Microsoft Teams Channel and show Conversation highlights with MS Graph API endpoints

This article helps you out integrating the Microsoft Teams channel data into custom web applications. Assume an use case, web application has channel mapping, where the app interface needs to show the highlights of latest conversations from respective team channels.

Currently the graph endpoint which exposes the channel messages is beta and available as protected endpoints.

Note: Microsoft Team restricts more sensitive data, and integrate the endpoints if there is a need. Please read out the following notes for the integration guidance.
  • This article little focuses on information about integrating protected APIs. As of today, Microsoft has restricted integrating some of their beta APIs. The protected endpoint list is shown here. https://docs.microsoft.com/en-us/graph/teams-protected-apis
  • To enable the protected APIs for integration, you would need to reach out to Microsoft team for integrations. The request could be submitted through this form. https://aka.ms/teamsgraph/requestaccess
  • The request is generally reviewed, approved and enabled over a timeline mentioned in the article. 
  • The request form needs to be filled with tenant, Azure AD app (explained below) and other details. 
  • Once the request is approved, you will get a notification over email confirming the API enablement within specific timeline. 


Azure AD App Registration and Configuration


Before submitting the request, an Azure AD app needs to be registered on the tenant. The use case requires to get the channel conversations. So, the following snapshot shows the configured and granted permissions. Apart from this configuration, the other key parameters needs to be configured.
  • Enabling oAuth implicit flow. 
  • Enabling implicit tokens 
  • And providing redirect APIs. 
API permissions required for integration
API permissions required for integration


Sunday 8 March 2020

Search for Documents from Microsoft Teams Channel Conversations

This article illustrates a sample for finding the documents available on a team, with keyword search from channel conversations. This is achieved with the help of outgoing webhook service, where documents from Team are being pulled with the help of Microsoft Graph API.
#Azure #GraphAPI #MicrosoftTeams #Office365

The following screenshot shows the list of documents retrieved sending the keyword via the channel conversation.
Finding documents from channel using outgoing webhooks
Finding documents from channel using outgoing webhooks

Tuesday 18 February 2020

Retrieve Office365 People data on MS Team Channels via Outgoing Webhook and Azure App Service

Here, let us see how office 365 people information can be integrated into Microsoft Teams, with the help of outgoing webhooks on Teams. The use case is to pull the people present at a location, on posting a message to a service from Microsoft Teams.  

This could be easily achieved with the help of outgoing webhook feature under teams. The webhook has to interact with a service to get data processed based on data posted. 

Why Outgoing Webhook?: The outgoing webhook is used here instead of incoming webhook, since the data needs to be retrieved only when it is required.

No BOT Framework, only Azure App Service: This article helps us to understand creating outgoing webhook services for Microsoft Teams, without creating BOT service/app. Here the intent of service is clear, so we are not leveraging the BOT framework, instead hosting a simple service with Azure web app. From azure web app, the people data is being pulled from Azure AD with the help of Microsoft Graph API.


Create an outgoing webhook for a Microsoft Team 


Locate a team under Microsoft Teams, and navigate to manage team. Under App, in the bottom right corner, you will find an outgoing webhook link. From the link, create a webhook.  

Outgoing Webhook creation on Teams
Outgoing Webhook creation on Teams

Saturday 4 January 2020

Ask Alexa to search for a Microsoft Team – Integration of Amazon Alexa Skill with MS Team using Azure Functions and Graph API

The article helps understand how to integrate your Amazon Alexa with Microsoft team using Azure functions and Microsoft Graph API. The use case demonstrated here is finding a team on Microsoft Teams via Alexa. You can implement plenty of use cases.

This requires the following components.
  • Amazon's Alexa developer console for testing, and Alexa device for real demo.
  • Azure Subscription - Azure function to host request/response code for Alexa device, which integrates with Microsoft Graph API
  • Office 365 tenant - with Microsoft Teams enabled. 


Configure Skills on Alexa Console


From the Amazon Alexa console (https://developer.amazon.com/alexa/console/ask), create a custom skill. The following steps has to be created on the console.
  • Create invocation utterance - This is the skill invocation keywords on Alexa. In my case, invocation would be “team finder”
Invocation your skill by saying team finder
Invocation your skill by saying team finder

Saturday 21 December 2019

Microsoft Teams List (Part II) – Building End-user interface on PowerApps to identify Membership Information

Let us see how to create an interface on Power Apps platform, listing down all the teams under office 365 Microsoft teams tenant, also enable options to join the team if user is already not a member.

In the previous article, we have seen the ways to identify the user membership information via Microsoft Graph API. Using these Graph API and information, we will build the user interface functionality.

Here, a simple app is built for end-users on Power Apps platform, which in turn connects to Microsoft Graph API data explained in the previous article. The below snapshot shows the end result.
Microsoft Teams List - Options showing if user is member of /or join team button
Microsoft Teams List - Options showing if user is member of /or join team button 

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

Friday 6 December 2019

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

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

Thursday 10 October 2019

PowerApps - App to Show Microsoft Teams members using MS Graph API


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
Demo App to Show MS Teams Data

Let us look at step by step approach for achieving the functionality.

Sunday 7 April 2019

Using MS Graph API and Adaptive Cards for Search/Render User Details with SPFx solutions

In this article, we will learn how to develop SPFx webparts for Office 365 SharePoint site and Microsoft Team, that leverages Microsoft Graph to search users and adaptive cards for rendering the user data effectively.

The sample used here uses the adaptive card, which has a very minimal UI. The sample used, shows how effectively UI could be changed by users. But complex custom UI could be built using the adaptive cards.

Adaptive Cards:

Let us use the adaptive card on our SPFx component for displaying user details. The following provides you the basic understanding.
  • Introduced recently, a new way for developers to render content in a consistent way, which is a open framework. 
  • It is providing options for developers, to design the UI for the specific component, using schema or visually.
  • https://adaptivecards.io/designer
  • Primarily targeted for BOT frameworks, Teams, Cortona, and windows notifications.
The following snapshot showing the UI built for our sample. This snapshot has 2 container sets for displaying 2 user details. In the schema mentioned later in the article, the single container is used, which could iterated using for loops for building containers for the required user set.

Adaptive Card Visual Interface for building component with UI
Adaptive Card Visual Interface for building component with UI

Monday 20 November 2017

Working with Calendar events from Office 365

In this article post, let us look at the way of accessing the Office 365 calendar events programmatically using REST APIs.

In the samples shown, calendar events will be accessed from SharePoint portal pages using two ways. One way is to use the graph API and the other way is using the outlook API.


Outlook API vs Microsoft Graph API:


Outlook API has lot of API end points to access the mailbox data in office 365 or other Microsoft mailbox services. It has around 11 API subsets for accessing various components under outlook like calendar, contacts, etc.

Microsoft Graph API, helps getting connected to multiple Microsoft products or services. The services include outlook, teams, SharePoint, people etc. This also helps in accessing other user information as well.

Sunday 5 November 2017

Working with Microsoft Teams from SharePoint Using Graph API

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.



Test


Test the functionality by hitting the SharePoint page URL. The snapshot shows the Microsoft Teams.