Build conference was held in San Francisco this week (from April 29th to May 1st) and it was the place to be because Microsoft made a lot of announcements around its ecosystem (Windows 10, Azure, HoloLens, Office 365…).
Among all the news annouced this week, we particularly appreciated the launch (in preview version for now) of the Office 365 unified API. Let’s take a look to this new API.
Why a new API ?
As you probably know, Office 365 offers a lot of features for companies who needs a directory, emails, instant messaging, collaboration, videos, search, social network…
Each of these features are offered by a dedicated product (Azure AD, Exchange, Lync, SharePoint, Yammer, OneDrive for Business…) and it was pretty complicated to develop solutions which are connected with all of them.
Indeed, each product has its own API, accessible through a dedicated endpoint :
- Azure AD => https://graph.windows.net
- Exchange => https://outlook.office365.com/api
- SharePoint => https://tenant.sharepoint.com/_api
- Office Graph => https://tenant.sharepoint.com/_api/search
- OneDrive for Business => https://tenant-my.sharepoint.com/…/_api/v1.0/files
- Yammer => https://www.yammer.com/api
It’s to simplify all of this, that the new Office 365 Unified API was created. It allows developers to create solutions which are able to reach the content of each product from a single endpoint.
A single endpoint is more easy to use and it simplifies a lot of tasks such as managing authentication tokens (you need one access token for each endpoint when you use the actual Office 365 APIs).
This new API works like the actual APIs so to use it, you need to :
- Register you app in Azure AD
- Define permission scopes and security
- Authenticate through OAuth 2.0
To retrieve data from your tenant and after successful completion of the authentication process, you can send requests to the endpoint as you can see in the following examples.
Me (or other users)
Get information about the current user (the authenticated user) :
Get the picture (of given dimensions) for the current user :
Get the manager, the subordinates or the groups for the current user :
https://graph.microsoft.com/beta/me/manager https://graph.microsoft.com/beta/me/directReports https://graph.microsoft.com/beta/me/memberOf
Get information about another user in your company’s directory :
https://firstname.lastname@example.org https://email@example.com/manager https://firstname.lastname@example.org/memberOf
Get the email messages for the current user :
Get the last 5 message for the current user :
Get the next 5 messages ordered by creation date :
Calendar / Events
Get the events for the current user :
Get the events for the current user between the start date and the end date:
SharePoint Files / OneDrive Files
Get OneDrive’s for Business files for the current user and get a specific file by using its ID :
Get OneDrive’s for Business files for a given user :
Get the groups (collaboration and not security/distribution) for your company :
Get the members, the files, and the conversations for a group by using its ID :
https://graph.microsoft.com/beta/contoso.com/groups/<id>/members https://graph.microsoft.com/beta/contoso.com/groups/<id>/files https://graph.microsoft.com/beta/contoso.com/groups/<id>/conversations
Office Graph / Delve
Get the people with whom the current user work with :
Get the data (documents, email attachments…) which are trending around the current user :
What’s coming next ?
In the examples presented in this article, we only saw how to get data but you are already able to perform CRUD operations as you can do it today with other dedicated endpoints.
It’s also good to note that Microsoft has updated its client libraries for .NET, iOS and Android to support the new unified API.
The Office 365 Unified API available today is just the first version (a preview version) and a lot of improvements will be available in the future. New data types will be added in the next few months.
Among some of the improvements already announced by Microsoft during the conference :
- Personal Contacts
- And much more…
Want to learn more and want to try it ?
The first thing to see if you want to discover the new API (this article was based on it) is the webcast of the session named “Supercharging Your Custom Solutions with the Office 365 Unified API Endpoint” which has been recorded during the Build conference. It’s available on Channel 9 : http://channel9.msdn.com/Events/Build/2015/3-641
If you want to learn more about the new Office 365 Unified API, you can also refer to the official documentation available at http://dev.office.com/unifiedAPIs.
Microsoft has also created/updated some websites if you want to try the new API directly from your web browser: