Introduction
Retrieve Boards
Board is just a way to categorize the documents on the site. The operation shown below will fetch all the board names that the user has added it to his documents. Say for example, user has added board called “Cricket” to two documents and “Tennis” to one document. This means the user is following two boards. They are Cricket and Tennis (these values will be listed on Delve left pane). There can be boards added by other users as well, which will not be listed on the user's Delve page. We will see how we can retrieve these boards from Office 365 Delve.
- The search API is used to pull the information.
- The necessary parameters to query the board details are the query text and properties. In the query text, we need to pass the path to get the board names available on Delve. We need to set the external content to be true in the properties, so it will retrieve all the properties related to the board.
- Using Ajax call with get method, retrieve the board names. Set the necessary parameters in the Ajax method.
- var getBoardURL = "/_api/search/query?QueryText='Path:\"TAG://PUBLIC/?NAME=*\"'&Properties='IncludeExternalContent:true'";
- $.ajax
- ({
- url: getBoardURL,
- method: 'GET',
- async: false,
- headers:
- {
- "Accept": "application/json; odata=verbose"
- },
- success: function(response)
- {
- // Get the exact result set.
- var resultSet = response.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;
- // Loop through result set to get the properties for each boards.
- for (var i = 0; i < resultSet.length; i++)
- {
- console.log("Title : " + resultSet[i].Cells.results[3].Value);
- console.log("Actor ID : " + resultSet[i].Cells.results[1].Value);
- }
- },
- error: function(data) {}
- });
- The board actor ID (identified in the section, above) is used to retrieve the respective board documents.
- To retrieve the documents, we will the use search API again to pull the information.
- The necessary parameters are the query text and properties. In the query text, pass * or any keyword to retrieve the documents. In the properties parameter, pass the graph query along with actor ID (identified in the section, above) of the board and action ID. (Here, action ID should be 1045 to denote the board). Here, we are passing single board actor ID to retrieve the particular board documents. You can change the logic to get multiple board's documents.
- var actorId = ""; // Set the actor id of board (can be identified from above section) to see the documents.
- getDocumentURL = "/_api/search/query?QueryText='*'&Properties='GraphQuery:actor(" + actorId + "\\,action\\:1045)'"
- $.ajax
- ({
- url: getDocumentURL,
- method: 'GET',
- async: false,
- headers:
- {
- "Accept": "application/json; odata=verbose"
- },
- success: function(response)
- {
- // Get the exact result set.
- var resultSet = response.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;
- // Loop through result set to get the documents from the board.
- for (var i = 0; i < resultSet.length; i++)
- {
- console.log("Title : " + resultSet[i].Cells.results[3].Value);
- console.log("URL : " + resultSet[i].Cells.results[6].Value);
- // Similarly other values can be retrieved
- }
- },
- error: function(data) {}
- });
In these cases, you can check the result values in a Browser debugger console. You can change the logic to display the results on the pages. Place these scripts on the page, using the Web parts (Content Editor / Script Editor / any custom Web part).

Roshni GandhiPosted Nov 21, 2018, 12:49 AM
Hey there, the script for getting all the boards is not loading any board. could you please help me with this?
Devang MistryPosted Jan 15, 2018, 11:49 AM
Great article. You mentioned this script can be embedded in either the script editor or Content editor web parts. Let's say if i am using script editor web part and i need to show recent documents for the current logged in user, should i just copy paste the code in the web part you mentioned above?
Kaviya BalasubramanianPosted Jun 13, 2016, 12:25 AM
Useful one
Vignesh ManiPosted Jun 11, 2016, 4:44 PM
Goon one
Asad AliPosted Jun 10, 2016, 4:26 AM
Good share
Bhuvanesh MohankumarPosted Jun 10, 2016, 1:00 AM
Good one...
Bhuvanesh MohankumarPosted Jun 10, 2016, 12:59 AM
Good one...
RajaPosted Jun 10, 2016, 12:34 AM
Nice Share...
Debasis SahaPosted Jun 10, 2016, 12:16 AM
Good one..
Santhakumar MunuswamyPosted Jun 9, 2016, 11:57 PM
Thank you for sharing
Sonu ChaudharyPosted Jun 9, 2016, 4:48 PM
nice share