The Office 365 API is up and going, but Microsoft urges developers not to use it in production just yet.
“Feel free to experiment with querying the Office graph, but do not use these features in production.”
The Office 365 API is basically a layer on the Search REST API which gives you some very nice features. I’ll talk a bit about these in this blogpost.
There’s three different “nodes” in the Office 365 API.
An actor is a user who has an edge (or a relation) to an object (a document, webpage, task etc).
The most important properties of the Edge is:
|ActorId||The ID of the user/actor. The ID for yourself is ‘ME’.|
|ObjectId||The ID of the object the user/actor has an relation to|
|ActionType||The type of the relationship|
|Time||Timestamp. The type of timestamp depend on the type of relationship (ActionType)|
|Weight||A number that indicates the importance of the relationship|
The following relationships (Edges) are available:
ID used in REST queries
|PersonalFeed||The actor’s personal feed as shown on their Home view in Delve.||1021|
|Modified||Items that the actor has modified in the last three months.||1003|
|OrgColleague||Everyone who reports to the same manager as the actor.||1015|
|OrgDirect||The actor’s direct reports.||1014|
|OrgManager||The person whom the actor reports to.||1013|
|OrgSkipLevelManager||The actor’s skip-level manager.||1016|
|WorkingWith||People whom the actor communicates or works with frequently.||1019|
|TrendingAround||Items popular with people whom the actor works or communicates with frequently.||1020|
|Viewed||Items viewed by the actor in the last three months.||1001|
|WorkingWithPublic||A public version of the WorkingWith edge.||1033|
Doing actual queries
An Office Graph API query is built up almost the same way as a standard REST API search query.
The standard Search REST API endpoint is as most of developers know
To do an Office Graph query you only need two parameters on this endpoint:
- The search query
- The Office Graph “Filters”
Everything I have an relation to
Documents I’ve viewed the last three months
Documents trending around me
<tenant_address>/_api/search/query?Querytext=’ ContentType:Document’&Properties=’GraphQuery:ACTOR(ME\\, action\\:1020)’
Documents I’ve modified the last three months
<tenant_address>/_api/search/query?Querytext=’ContentType:Document ‘&Properties=’GraphQuery:ACTOR(ME\\, action\\:1003)’