A Guide for using Microsoft’s Graph Connector in Mendix
Mendix provides the capability to Integrate Microsoft Graph APIs (Teams, Chat, Email, Files), into Mendix with the help of the Microsoft Graph Connector.
In this blog I’m going to cover all the topics on how to integrate Microsoft’s connector using Mendix Studio Pro:
In this Blog
1) How to install the MS Graph Connector and basic setup
2) How to register for a Free Azure account for trial purposes
MS Graph Connector
Step 1:
First, we will create a demo app with Mendix version 8.12 or higher.
Step 2:
We need to install some required modules from the Mendix Marketplace, mainly:
1. Encryption (please set the 32-bit encryption key as per the below image)
2. Community Commons
3. Nanoflow Commons
Step 3:
We need to download and configure the Microsoft Graph Connector module from the marketplace and change the security level.
https://marketplace.mendix.com/link/component/117007
Step 4:
Add the snippet named ‘Snip_Authentication_Overview’ to a page accessible to you. This will be for your app’s administrator so that the admin will do all the configuration for the typical user using SNIP_Login.
Step 5:
Run the app and check once.
Next up, Azure registration
Now that our setup is ready, we need to do some basic configuration.
1. We should have access to the Azure portal and we will now register our app on Azure.
2. If your company policy won’t allow you to create the new app, you can ask for registration with the below steps
3. And for trial purposes, you can register on Microsoft 365 Dev program so you will get a complete setup along with a demo user ID.
Please register here for your Microsoft Azure Account
Next, I will talk you through the registration of the app and how to correctly configure it.
Once you’ve registered, please log in to the Azure Portal with the below link:
You should now see the Azure portal’s dashboard as shown below
Once you’re logged in search for ‘Azure Active Dictionary’ and click to open.
Please click on ‘App registration’ and click on ‘New Registration’ once redirected.
Register your app:
1. Name: Provide any suitable name
2. Supported account type: You can choose as per your requirement
3. Redirect URI: http://localhost:8080/oauth/v2/callback_azure
After the registration, you will see the below screen with all the details
required to complete the configuration of your app:
1. Application ID
2. Tenant ID
3. Client Secret
4. Redirect URI
Application ID and Tenant ID are already there so we need to create the client secret as well as needing to add some more redirect URLs.
Getting the Client's Secret
Click on ‘Add a Certificate’ and then click on ‘New Client Secret’ to create a new client secret.
NB! Please copy the value of the client's secret and save it somewhere secure. It will be encrypted and you will not be able to view or copy it again after this point.
We need to use Value and not ID in our application.
Once you’ve registered the app on Azure, you need to add other URLs, one for local testing — http://localhost:8080 — and one for both acceptance and production — eg. https://Prod_Or_Accp_URL/oauth/v2/callback_azure.
To do this click back and go to Redirect URI and add the URLs for local, acceptance, and production.
Configuring your Mendix App
Now we are ready with all the details and can continue with configuring our Mendix app.
Run the app and click on ‘Add Authentication’.
Fill in the details listed below:
- Display Name — any name can be provided
- Application ID — application ID in Azure Portal
- Tenant ID — tenant ID in Azure Portal
- Client Secret — client secret in Azure Portal
- Selected Scope — four scopes (one permission provided by default, the other permission you can add on ‘Meta Data’ in the last pop-up.
- Selected Response Type — code
- Selected Response Mode — query
- Prompt — consent
Note — You need to provide the correct scopes for using services, some commonly used scopes are:
Mail — sending and receiving mail
Teams — read and write on Teams channel
Chat — one-to-one chat is supported
Calendar — you can access the calendar and schedule meeting invites
Files — you can access all Microsoft files
For references around scope, you can check the below link:
Now click on ‘Get Authorization as User’.
Next, you will be redirected to the consent page and you will need to accept it.
Now please click on ‘View Resources.
You can now make use of all the services provided by this connector. Well done, you’ve made it to the end!
Thanks for reading this article, if you have any suggestions or feedback, please comment down below.
Read more
The Microsoft graph connector Mendix Marketplace Module
From the Publisher -
If you enjoyed this article you can find more like it on our Medium page. For great videos and live sessions, you can go to MxLive or our community Youtube page.
For the makers looking to get started, you can sign up for a free account, and get instant access to learning with our Academy.
Interested in getting more involved with our community? Join us in our Slack community channel.