Display all site notebooks on SharePoint

When you are working with site notebooks in SharePoint, it’s quite difficult getting an overiew of all your feature based site notebooks on a single page. Sure, you could get the overview by having a look at the notebooks opened in the OneNote client application but it’s not appropriate, I think. So, here is a proposal for an automized solution done by SharePoint search.

Illustration 1: webpart displaying all site notebooks from SharePoint.

First, let’s have a look at the solution giving us an overview of all the feature based site notebooks across our SharePoint farm. This is basically a SharePoint search results webpart displaying the site notebooks from several locations with some default metadata like the author and the date of last modification.

The pattern we are using to define the scope (result source) is basically the fact that all the site notebooks are located in the site assets library by default. This is quite useful because nobody would sync such a document library with OneDrive for Business client application causing potential problems with OneNote offline synchronization. Keep in mind, that OneNote takes care of offline sync on it’s own! The sections are interpreted as a document by SharePoint (*.one) – but we don’t want the sections, we want the notebooks for our overview. You can not reference to the root-file of the notebook as well, because it’s always named the same (Open Notebook.onetoc2). From the SharePoint perspective, all those notebooks are interpreted as a folder, not a document. For getting rid of results from the notebooks’ recycle bin we just use a negation expression with KQL as you can see in illustration 2.


Illustration 2: Querying all site notebooks with KQL.

For getting the visual customizations done, we just define a custom logo for OneNote-results (line 40), after uploading the logo to an appropriate location. For displaying the author and modification date we extend the code in line 45 and 46 which is related to default managed properties. Don’t forget to generate a new custom display template for  your custom code.


Illustration 3: Customization of display template for OneNote results.

Author: Karsten Ulferts

This entry was posted in Development and tagged , , , , , , , , . Bookmark the permalink.

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