The One True API
As noted in my post about using the Graph Explorer tool, the Microsoft Graph has become the de facto API for most if not all Office 365 workloads. Some legacy APIs persist, like Exchange Web Services (for more information about using EWS, see Glen Scales’ blog), but the wind of Microsoft investment and engineering staff is behind the Graph, so it should be your future focus for programmable access to Office 365 data.
The biggest advantage the Graph brings to the programming community is to deliver a standardized method of dealing with the myriad forms of data found inside Office 365 from email to documents to people to calendars and anything in between. Authentication is based on OAuth, so it follows standards too. Anyone who knows how to use a REST-based API will be comfortable with the Graph.
PowerShell and the Graph
A word about PowerShell is in order here. The advent of the Graph doesn’t mean that PowerShell is going to go away anytime soon. Although many parts of Office 365 are now built using the Graph, PowerShell is still used throughout the suite to get stuff done. More importantly, PowerShell is used to solve administrative problems by a very large community of Office 365 administrators. The basic division between PowerShell and the Graph is that PowerShell never goes near data inside user repositories. You can use PowerShell to fetch details about a user mailbox, but not the actual contents of the mailbox. In the past, that work would be done by EWS; now, it’s a task for the Graph.
So, if you’re looking for something to automate administrative operations for Exchange, Teams, or Azure Active Directory, PowerShell is probably the best choice. On the other hand, if you want to manipulate messages, meetings, or contacts, go for the Graph. In some cases, like Teams or Planner, you might not be able to do something with PowerShell and have to use the Graph, but that’s OK because you can call Graph operations from PowerShell (here’s an example of using PowerShell and the Graph to process Teams data). Choice is good, and it’s good to have a choice of tools (if only we were granted the insight to make the right choice each time).
A New Series
To help programmers understand the Graph, Microsoft is running a “30 days of the Microsoft Graph” series of blog posts. Each post is intended to take 5-15 minutes to read about a topic linked to the Graph. The first few introductory posts are now online and are worth reading if you haven’t heard about the Graph.
The Office 365 for IT Pros eBook isn’t about programming Office 365, so we don’t touch on the Graph (too much). On the other hand, because a lot of what the book covers is how to automate common administrative operations, we include a lot of PowerShell. Over 1,100 examples in fact.