Getting all documents from a Delve board using the Office Graph


When building custom solutions with the Office Graph you might want to show boards and their documents. Find out how to get the list of documents from a specific board using the Office Graph API.

In my previous article we discussed how to programmatically retrieve the list of all boards from Office Delve. In this article let’s take a look at how to retrieve documents from a particular board.

In order to retrieve all documents that belong to a particular board we have to issue the following Office Graph query:

actor(<board id>, action:1045)

1045 is a new action that represents documents belonging to a board. As discussed in my previous article the ID of the board can be retrieved using a regular search query:

https://contoso.sharepoint.com/_api/search/query?QueryText='Path:TAG://PUBLIC/?NAME=Reports'&Properties='IncludeExternalContent:true'&SelectProperties='DocId,Title,Path'&RankingModelId='0c77ded8-c3ef-466d-929d-905670ea1d72'&ClientType='WaldekDemoApp'

Office Delve boards are stored in the search index and they can be retrieved by querying the Path Managed Property for a string following the format: TAG://PUBLIC/?NAME=<board name>. The ID of the board is then returned in the DocId Managed Property.

Arrow pointing to the DocId Managed Property of a Delve board

Having retrieved the ID of the board, we can now retrieve all documents that belong to that board:

https://contoso.sharepoint.com/_api/search/query?QueryText='*'&Properties='GraphQuery:actor(4304967296\,action\:1045)'&RankingModelId='0c77ded8-c3ef-466d-929d-905670ea1d72'&ClientType='WaldekDemoApp'

This is the most basic Office Graph query that will return the list of documents that belong to our board.

Arrows pointing to the number of results of the Office Graph and the title of the first document

In this example, as pointed out in the screenshot above, the query returned two results of which the first is the Marketing Campaign Effectiveness document – exactly what we see in the Reports board in Delve:

Reports board displayed in Office Delve

Similarly to other Office Graph queries, the query retrieving documents from a particular board can be extended with additional properties allowing to filter the documents on their type, date range, sorting them in a specific way and perform other operations that would be relevant for your scenario.

Summary

When building custom solutions with the Office Graph you might want to show boards and their documents. Using the Office Graph API you can build a query that will allow you to retrieve all documents that belong to a specific board. This query can optionally be expanded with additional operations relevant to your application.

Others found also helpful: