Microsoft now claims over 100 million active users of its Office 365 cloud collaboration suite. So, for various reasons, it is important to be able to extract data from Office 365. For this, Microsoft offers a solution: the Microsoft Graph API.
First, I will explain what needs Microsoft Graph can meet. Then, I will show you how to create an application using this API.
Microsoft Graph allows you to connect to many resources related to Office 365 (users, discussions, calendars, groups, ...). The name " Graph " comes from the fact that all these resources are interconnected, forming a network of objects.
For example, for a given user, Graph allows access to his messages, his calendar, his files, but also to the groups he belongs to. This user is also associated with a manager, one or more devices (PC, phone, etc.), and other things... These interconnections allow you to imagine many scenarios of use.
Why use Microsoft Graph?
On its site, Microsoft provides a whole list of examples to illustrate the potential of Graph. I will detail two of them that I find particularly interesting.
Development of an appointment scheduling application
The first is the development of an automatic appointment scheduling application. The application allows to propose appointment slots based on availability, office absence status, meeting rooms and associated documents. It's easy to see the value Graph adds in this case. The aggregation of collaborative data creates an application that enhances the collaboration itself. This appointment creation scenario can be applied in many situations (CRM, Helpdesk, etc...).
Creation of customized reports
The second is the creation of customized reports modeling Office 365 data. To know the added value and the ROI of a brick of the information system, it is necessary to make measurements. Collaboration is no exception to this rule. The investment for the implementation of Office 365 can be quite substantial (cost of licenses, governance) and many companies do not know if the platform is well used. Therefore, it is essential to measure its adoption.
Graph offers a whole list of reports (in CSV format) of uses and activities associated with the various Office 365 tools (Outlook, OneDrive, SharePoint, Skype for Business, etc...). This allows you to define dashboards, admittedly quite basic, but whose information gives a clear vision of the use of the various tools.
However, we can go further in the process. As I said at the beginning of the article, Graph objects are interconnected. To fully exploit Graph, it seems interesting to me to couple these different reports with other resources provided by the API (for example, by coupling the Outlook activity report with the "Files" resource to identify the types of files most sent as attachments).
So it is quite easy to find uses for Microsoft Graph. We will now see how to deploy it easily.
How to use Microsoft Graph?
The question of security
The first issue that arises, as with any IT project, is security. Any user should not have access to any resource. For example, a user should not access another user's mailbox. To use Microsoft Graph, you must first register an Azure Active Directory application on the Azure portal (for the detailed procedure follow this link). This application allows you to define the access rights to each resource. The administrator will define the different resources that can be accessed, depending on your needs.
It is also this Azure Active Directory application that provides the authentication context (token) for accessing resources. Thus, a business application that does not have this token will not be able to access Graph data.
Simplicity through a single URL
The second issue, in my opinion, is simplicity. The Graph API consists of a single REST URL(https://graph.microsoft.com). For each call, we also define the version of Graph used (1.0 or beta), the resource we want to access (for example /users to access the list of users), and possible query parameters (?$filter=startswith(displayName,'J') to retrieve all users whose name begins with the letter J). The HTTP response is in JSON format, a standard that can be used in most computer languages and whose main advantage is its simplicity.
Here is an example of a complete query URL Graph :
Graph allows to read data (GET) but also to create records. Indeed, thanks to the HTTP protocol, it is possible to do POST. A good example is the sending of emails with the resource (me/messages) by passing the JSON structure of the message as a parameter.
To test the API, Microsoft provides a simple and powerful web-based tool: the Graph Explorer. It allows to perform Graph queries and to interpret the results easily.
So there are many advantages to using Microsoft Graph. However, I would add some drawbacks.
Microsoft releases new versions of Graph every month and the changes are often major. It is therefore important to follow Microsoft's changelog and to monitor the API beta.
Graph 's resources are, in my opinion, very business-oriented (collaborative). An Office 365 administrator will not always find the information he is looking for. The best example is the "email" resource. Graph allows you to obtain the data stored in a mailbox but does not manage the global data transiting on Exchange Online. To retrieve administration information, it is preferable to use other APIs specific to each tool that are more "administration" oriented.
You now know the basics of Microsoft Graph. As the API is constantly evolving, new usage scenarios will probably appear in the near future to fully exploit the potential of Office 365.