A Day in Version 1’s Innovation Labs: Exploring Microsoft Graph
By: Cezara Molodiuc
Tags: Microsoft, Graph, Technology, Learning, Innovation

I am a senior consultant, who has been working in Version 1 Innovation Labs since September 2019. The Innovation Labs develop innovative solutions and proof of values for customers to ensure Version 1 remains at the forefront of disruptive technology. This blog will cover my day in Version 1’s Innovation Labs, where I looked into Microsoft Graph.

Photo by John Adams on Unsplash

The day starts with a team meeting (after coffee, checking emails, and preparation for the meeting). Each member of the Innovation Lab quickly provides an update on what they are currently doing. Topics on the call can range from customer issues to a team member exploring a new technology/product and making other people aware of what is there on the market. At the end of the meeting, there is a demo session where the team present projects they are working on, and showcase any demos to the rest of the team.

Photo by Tadas Sar on Unsplash

My task after today’s meeting was to explore Microsoft (MS) Graph. The requirement came from a customer request, with our customer’s employees spending a lot of time reading and uploading documents from their emails into their system. For some documents, there are specific fields that need to be extracted. The Document Insight Solution, developed by the Labs, is a good tool to scan the documents, identify the details that need to be processed and upload the fields into the case system through an API. However, before using Document Insights, a tool is needed to extract the attachment from employee emails and pass them to the Document Insight solution.

I began looking online to see what I can do with MS Graph. I started with reading a couple of articles on MS Graph to see what it can do and if it solves our problem. I was eager to see exactly what it can do so I went to try it. I opened this link, using my own Version 1 account, and tried to see what the functionalities are in there. I tried several options (the same as I would do in outlook):

· Get a list of emails

· Get the details for a specific email id

· Get an attachment for a specific email id

· Search for emails that have specific words and attachments.

The next step was to see how a Python Web App can be integrated with the Microsoft Graph API.

Searching for a Python Web App on GitHub as a starting point, I came across this. Now, with git repository cloned, I started to follow the steps in readme.md to set up the Python App. This was all good until I had to add a new registration on the Application Registration Portal.

Turns out, I didn’t have the required rights to do this using my work account. After a chat with the Data Protection Officer (GDPR!), he suggested that I create a Microsoft dummy email account and play with that. Whilst configuring my APP on Azure portal, I noticed that there is a Quick Start link, which offers some sample code for Web App.

I decided to abandon the APP that I downloaded from GIT and use the sample code from Azure Portal. The code that I’ve downloaded from the portal had slightly different instructions on how to set up the app, so I followed these.

I changed the CLIENT_ID, CLIENT_SECRET, AUTHORITY in app_config.py and I ran the Python APP.

After logging in, I could see the details about my dummy account that was created.

The next step was to change the code to read the email.

For this, I had to change the permission for my Azure API testGraph and then in the python code, app_config.py, I changed the SCOPE and ENDPOINT to get the emails for my user.

This worked until I ran the API and I received the error below:

After looking and trying different suggestions online, I finally found on MSDN that a subscription for office365 is required to access a user email. This meant that my dummy account wouldn’t work, until I get a subscription for Office365.

So, what did I learn from today?

· When prototyping / doing PoCs, never use production — you run into red tape and access issues. Always try to use a standalone test/dummy account.

· Graph APIs are great, they offer a lot of functionalities that can be used and can be easily integrated with python or any other application. Even if I didn’t get what I was looking for due to account limitations, I still managed to get user details easily.

· If one approach isn’t working, move on and try it a different way to get around your problem, e.g use a dummy account.

· It’s good to experiment and try new technologies as it allows us to make better and more informed decisions.

Even if I didn’t manage to get the list of emails from my dummy account, I learned how Graph API works, and how easily these can be integrated with an application. As I managed to receive the user details for my dummy account, this proved that my integration and API created on Azure works. I hope you enjoyed reading about my day in the Innovation Labs and hope this gave a good insight into the technology and areas we look into. Find out more about Innovation at Version 1 below.

The Innovation Labs have been in operation since mid-2018 with a full-time dedicated team exploring cutting edge technology. We have delivered many successful PoVs and are keen to engage with our customers to help them explore next-generation technologies that might transform their business. Find out more about Innovation at Version 1 here.