The slide from my talk at Drupalcamp Ghent 2024 about digital collaboration with Microsoft 365 and the Drupal CMS using the contributed module "Microsoft 365 connector"
2. About us
Me
• Fabian de Rijk, Alphen aan den Rijn NL
• fabianderijk on drupal.org
• Drupal developer at Finalist
Fi na l i st
• Drupal websites for Health and Education
• Supporter of Drupal Community
• Event sponsor & co-organiser
• Core and contrib maintainer
• Dutch Drupal Association member
3. What are we going to talk about?
#1 Why Drupal and Microsoft 365
#2 What is the Graph API?
#3 Setting up the module
#4 Examples & demo
#5 How to?
#6 Roadmap
#7 Questions
5. Framework that serves well as
social intranet or community
platform
Collaboration software with
video conferencing, chat and
documents
Microsoft 365 is go-to-software for most educational and governmental institutions.
6. • Advantages of both Drupal and Microsoft 365
• Provide single sign on via Azure (cloud platform Microsoft)
• Interact with the Graph API
So we built a module
Azure SSO
7. Gateway to almost all data living
within a Microsoft 365 subscription
and is therefore a super powerful API
for a lot of different use cases.
What is the
Graph API?
It’s all about together
Drupal is about together
It’s community is about together
And we think Drupal can be together with tooling like Office365
Drupal is a powerful framework that can serve really wel as a social intranet or community platform.
At Finalist, we are literally building digital workspaces wth Drupal in which student and teachers work together.
Microsoft 365 is collaboration software which is quite known. It has lots of features like Teams, with chat and video conferencing. And of course working together in documents.
We work in the fields of education and government, and whether you like it or not, Microsoft is go-to-software for lots of insitutions.
So….. We built a module that combines the advantages of both Drupal and Microsoft 365.
An important feature is single sign on, so you are immediately logged in with your Microsoft account.
This is important because once logged in, the Microsoft 365 connector can interact with the Graph API on behalf of your account.
This Graph API is superpowerful, because it is a gateway to almost all data living in your account.
This way we can use it for lots of use cases, which I will show you in the next half hour.
Using the Office 365 connector and its submodules we have added some functionality of what we thought would be helpful and to give you some examples which you can use to create your own modules.
Let me take you through some of them in a random order.
To be able to use the Microsoft 365 connector module you need to have an Azure app set up with correct permission scopes.
First create an app in Azure like you would when using OpenID. Just enter your basics like name and the Microsoft 365 connector specific return url.
Then create your secret (do not forget to copy it, you will see it only once) and start adding the API permissions.
The module will help you with that. When you install the base module it will create a page for you under Reports that shows a list of the authorization scopes needed to make all the functionality work.
This list of scopes will be automatically updated when you enable or disable submodules.
This list of scopes will be automatically updated when you enable or disable submodules.
Remember, the client id, tenant id and secret key are not saved in the Drupal database because of security reasons. They need to be added in the settings.php and you are ready for take off!
Using the Microsoft 365 connector and its submodules we have added some functionality of what we thought would be helpful and to give you some examples which you can use to create your own modules.
Let me take you through some of them in a random order.
Let’s start with the basics. Using the Office 365 connector module you can login to your Drupal site using your Microsoft 365 credentials.
It is even possible to sync data from Microsoft 365 for the logged in Drupal user or their respective profile. This can be used to save their full name, profile picture and more.
This is a rather basic function, however, it can be very handy. The module contains a block with links to all sorts of Microsoft 365 services. You can configure what services you want to show, so there is always a set of links that are useful to the user.
Using a combination of this module and the Group module you can connect groups with Teams. For now this adds a feature that lists files from a Team in the Group in Drupal. We also have added a feature for people to send messages from Drupal to others on Teams without leaving Drupal.
There is also an option to start a chat or a call with team members.
In the future there will be better integration with Teams (for instance your activity stream), and better and more integration between Microsoft 365 and Groups.
With the Outlook Calendar integration you can create events from Drupal nodes in your Outlook Calendar. Either from the creation of the node itself, or by using the block the module provides that outputs a button for users that creates the event on click.
In addition, the module makes it possible to show a block with the events that are upcoming for the currently logged in user.
The Outlook Mail integration provides 2 kinds of blocks. First of all, we have a block that exposes the last 5 e-mails in the users Inbox, second is a block which shows you unread e-mails in the inbox.
For now, these blocks only get mails from the Inbox folder, and a maximum of 5, but this will be configurable later. However, you can easily build this yourself as it fits your needs.
Let me show you a short demo of the possibilities this module has.
First, let us log in. As you can see, when the “Login with Microsoft Office” button is clicked we are taken to Microsoft where we need to authenticate ourself.
This means we are logged in, and we can retrieve data from the Microsoft Graph API using the Microsoft 365 connector module.
As you can see on the homepage we have some blocks that are generated by the module. We show the currently logged in user with the profile picture uploaded on Office and beneath that our upcoming appointments. When the event is an online meeting the link to join the meeting via Teams is automatically added. When you click on a event it will open the event in the Outlook Calendar.
In the third column you can see the 2 Outlook Mail blocks with the email sorted on date. When clicked on an email it will open the mail in Outlook Mail.
Also shown here are some blocks with recent or shared files and the block with the application links.
As said we have created a possibility to send a message to a user on Teams via Drupal. You can search for the recipient, add your message and click send. The message will be sent via Teams to the corresponding user, and will be sent by the currently logged in user.
As I said in the beginning, the submodules we have created can also be used as a beginning for custom functionality. We have, for example created a module that shows the user status and adds a dropdown for users from where you can call or chat via Teams or call the user via phone when used on mobile devices. And for a customer of ours we have integrated the Dropzonejs module with the abillity to upload large files that asynchronous get sent to a specific Sharepoint folder.
So, now for a bit of a technical bit. The module is built in a way to help other developers create their own additions.
When developing it can happen that the scopes the default Microsoft 365 connector module or one of it’s submodules use isn’t sufficient. When that happens you can use a custom hook we have added to the module. This hook adds the authorization scopes when logging in to Microsoft and makes the data in the Graph API accessible for the Microsoft 365 connector.
To retrieve data from the Graph API we have created a service for you called the GraphService. When using this service you have all the benefits of the Office 365 connector. This service already takes in account your status, and retrieves data from the Graph API as the current logged in user.
As you can see in the screenshot it is really easy to use. The getGraphData method in the service returns the data retrieved from the Graph API as is so you can do your own magic with it. The first parameter for the method is the endpoint in the Graph API which you can find in the API explorer at Microsoft.com
To post data to the Graph API you can use the sendGraphData method in the service. Just add the endpoint you would like to post to, and the data structure and you’re done! In the code example you can see how a event is created in my Outlook Calendar for Drupalcamp Ghent.
What do we want to do in the future?
Microsoft have released a new version of their SDK. This is a better and easier than the one we are using right now, so we need to update. This will take some time, because of the large changes.
Next to that we want to improve our documentation. It should be easier for other developers to use this module, just because it’s awesome.
For some time now there has been an active issue in the issue queue to allow multiple connectors. This way we can use multiple Azure apps, multiple tenants or Active Directories to retrieve data. This is helpful for environments where multiple organizations need to login to one system and don’t have a shared Azure environment.
And more, better examples, REST endpoints, etcetera.
Do you want to help in any further development? Or do you want to use the module? Just take a look at the project page on drupal.org!