A quick introduction to the Office Graph API

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.

  • Actor
  • Edge
  • Object

The Actor

An actor is a user who has an edge (or a relation) to an object (a document, webpage, task etc).

The Edge

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

Source: http://msdn.microsoft.com/en-us/office/office365/howto/query-Office-graph-using-gql-with-search-rest-api

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:

  • Querytext
    • The search query
  • Properties
    • The Office Graph “Filters”

Everything I have an relation to


Documents I’ve viewed the last three months

<tenant_address>/_api/search/query?Querytext=’ContentType:Document’&amp;Properties=’GraphQuery:ACTOR(ME\\, action\\:1001)’

Documents trending around me

<tenant_address>/_api/search/query?Querytext=’ ContentType:Document’&amp;Properties=’GraphQuery:ACTOR(ME\\, action\\:1020)’

Documents I’ve modified the last three months

<tenant_address>/_api/search/query?Querytext=’ContentType:Document ‘&amp;Properties=’GraphQuery:ACTOR(ME\\, action\\:1003)’


One thought on “A quick introduction to the Office Graph API

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s