Saturday, October 4, 2014

Office Graph support in the SharePoint 2013 Search Query Tool

I just compiled v2.2 of the SharePoint 2013 Search Query Tool which has one major new function: Support to query the Office Graph in Office365 using GQL (Graph Query Language). Many thanks to Barry Waldbaum @ Microsoft for starting the work on this feature, and the joint effort to bring it into the tool.

If you choose SharePoint Online as the authentication method, you will see a couple of extra fields in the tool:

  • Graph Query
  • Graph Ranking


If you specify Graph Ranking, the tool will also automatically add 0c77ded8-c3ef-466d-929d-905670ea1d72 as the ranking model id as specified in the MSDN documentation.

If you don’t have a particular query to run, pass in * as your query text, and using REST you get a calling URL like this:'*'&properties='GraphQuery:ACTOR(ME\, action\:1020),GraphRankingModel:{"features"\:[{"function"\:"EdgeWeight"}]}'&rankingmodelid='0c77ded8-c3ef-466d-929d-905670ea1d72'

If you look at the network trace from Delve you can see queries like the ones below, which are now easy to test.



The tool will do all the encoding for you and construct the properties part of the query. For your results you will get back a managed property named Edges, which contain information about the link between the actor and the object, all pretty printed for your pleasure!


I have plans to add helpers to transform the action codes to a readable names which makes it easier to write GQL, so watch out for this in the future.

Happy GQL’ing!


  1. Hi Mikael,

    We are facing an issue while accessing sharepoint 2013 search rest api

    through ajax jquery inside an html page

    The page is hosted in iis on a different server other than Sharepoint 2013.

    In IE we are able to get results but on chrome following error is comin

    XMLHttpRequest cannot load http://usctapd00764/_api/search/query?querytext=%27merck%27.

    No 'Access-Control-Allow-Origin' header is present on the requested resource.

    Origin 'http://usctapc00067:4141' is therefore not allowed access.

    The response had HTTP status code 401.

    1. CORS is not enabled by default in SharePoint and you have to set it yourself via IIS or a handler.

  2. This comment has been removed by the author.

  3. It doesn't work with HTTPS, right?

  4. If i need to get content for a different user, i change ME to actorId. But how do i get actorIds of the users?

    1. It's the DocId/WorkId of people search. https:///_api/search/query?Querytext='Username:carls'&SourceId='b09a7990-05ea-4af9-81ef-edfab16c4e31'&SelectProperties='UserName,DocId'

      All in th GQL docs on MSDN :)

  5. Thanks a lot. I couldn't figure it from the Docs.

    1. Np :) It's on this page a bit down: