Technical documentation¶
These pages are for people writing code against the connector: custom blocks, extra Graph calls, extra scopes. For installing and configuring the module, see the earlier pages in this guide.
Two things are worth knowing before you start.
The connector works on behalf of the logged in user, not on behalf of the site. Every Graph call runs with that user's delegated permissions and returns their data. There is no application-level access token, so there is nothing to call Graph with during cron, on a queue worker, or for an anonymous visitor.
And anything you fetch from Graph is per user and usually short lived. Treat it that way when you decide how to cache it.
In this section¶
The Graph service¶
Everything goes through o365.graph, the \Drupal\o365\GraphService class. Its
public methods:
| Method | Use for |
|---|---|
getGraphData() |
Reading from an endpoint. |
sendGraphData() |
POST, PATCH and DELETE. |
getCollectionData() |
Endpoints that return a paged collection, when you want the SDK's collection request rather than a decoded array. |
getCurrentUserId() |
The Microsoft ID of the current user, or FALSE when there is none. Doubles as "is this user linked to Microsoft 365". |
getTimeout() / setTimeout() |
The request timeout, in seconds. Raise it before a call you know is slow, such as a deep manager expansion. |
For the full signatures, the class hierarchy and everything not covered here, Doctum builds a reference from the source at o365-docs.netlify.app.
Extending the module¶
The hooks this module invokes are documented in o365.api.php in the repository
root.