Jaa


Introducing the OneNote Search API (Beta), powered by Bing

 

Hi All,

When we first started working on the API we had the vision to make OneNote the one-stop-shop for anything people want to remember - whether that be work or personal. Search is a key part of that vision and today we are announcing the availability of the OneNote Search API in Beta.

Over the last few months, we have been partnering with the folks over in Bing to integrate their search tech into our service and bring the power of full text search to the OneNote API. It's like having your own personal search engine for your private notes and memories in the cloud. And, because we are reusing the same search tech powering bing.com today, the OneNote search API has all the smarts you would expect from Bing such as: spelling forgiveness, stemming, relevance and ranking, word breaking, phrase search, etc. The search API works across notebooks so your app can find the right notes for the user no matter where they are stored. Under the covers, there is a personal index per user so searches are scoped to only the notebooks the user has access to. 

Ready to give it a shot? Here's how to get started:

1) Sign up for the Beta
Sign up so we can index your notebooks. Click the "Sign Up" button below, sign in with your Microsoft account if/when prompted, and grant read permissions to the OneNote Developer Blog App.

Note: During the Beta it could take up to 2 hours for your notebooks to get picked up by the indexer. We appreciate your patience. 

2) Try searching your notes
If you've tried other OneNote APIs in Beta it is very likely we have you covered already. Best way to find out is by trying a few search queries below. If you get some page results back, congratulations, we have indexed your notebooks and you are ready to go.

Searching across notebooks
Using the search API your app can search across all notebooks owned by the user. To do so you should ask the user to grant your app at least one of the 2 permission scopes below depending on what your app needs to do:

1) office.onenote - Use this scope if your app needs to search all pages across all notebooks the user owns. 

2) office.onenote_update_by_app - Use this scope if your app needs only to search the pages created by itself.   

To make a search call simply issue an HTTP GET to: https://www.onenote.com/api/beta/pages?search=foo, where foo is the search term you want to look for. The response will be identical to the query pages response outlined in this post
 

Searching within a section
You can also scope search queries to a particular section by making a GET request to: https://www.onenote.com/api/beta/sections/{id}/pages?search=foo , where {id} is the id of the section. 

Search and OData
Finally, you can combine the search verb with any of the OData verbs we already support  (check out this post for reference) such as filter, select, orderby, etc. You can try these and other queries using our Apigee console. For instance:

Let's say you want to scope your search to only pages created as of 6 months ago. You can do that as follows:

GET https://www.onenote.com/api/beta/pages?search=foo&filter=createdTime gt 2014-05-17 

Or perhaps you want to get the next page of search results. Then you can write your request as:  

GET https://www.onenote.com/api/beta/pages?search=foo&skip=20, where skip is the item offset. You can also use top to specify a different page size up to a max of 100 results per page. 

 

There you have it. Now you can use search in conjunction with page updatepage recall, and page query to light up some interesting scenarios. 

Coming soon:

  • Support for searching across notebooks shared with the user
  • Scope search queries to a particular notebook
  • Support for page last modified time
  • Relevance and ranking improvements

As always, we are looking for your feedback. Leave your comments below and let us know what you like and what should we add/change before releasing the OneNote Search API to production. 

Happy coding,

-Omar

Comments

  • Anonymous
    November 17, 2014
    Will there be tag-related searches? eg "all pages containing tag "foo1" or "foo2".

  • Anonymous
    November 17, 2014
    A sorting tool. Can you add a sorting tool to sort sections, pages, and even notebooks? It would be extremely useful to be able to sort alphabetically, numerically, or by date last edited, with an ascending/descending option.

  • Anonymous
    November 18, 2014
    Very Good!

  • Anonymous
    November 18, 2014
    @Ricardo: Yes, page query based on tags is coming. We will support client note tags first such as: to do, important, contact, phone number, etc. @Rachel: We currently support sorting notebooks, sections, section groups and pages through the API. Using the "orderby" OData verb a tool can be written to describe what you mention. We don't currently support page last modified time but it's coming.  

  • Anonymous
    November 18, 2014
    Gostaria de conhecer esse novo sistema da Microsoft.

  • Anonymous
    January 01, 2015
    This seems to imply the search is for Microsoft cloud-stored OneNote notebooks only.  Is this accurate or will the search be functional to locally stored notebooks for an entprise?  In our case, we have notebooks stored on a local Windows server in a series of shared folders (all under one UNC).  Should I expect this search to work in this context as well?

  • Anonymous
    January 05, 2015
    Hi Terry. That is correct. The search API currently covers notebooks stored in OneDrive. For enterprise scenarios, we will support notebooks stored in OneDrive for Business as well. If it is an option for your company, I would encourage moving to OneDrive for Business.

  • Anonymous
    January 06, 2015
    Thanks, Omar. Our corporate use of OneNote is in conjunction with a structured UNC and we access OneNote notebooks programatically from other applications with a 'foreign key' (of sorts) that allows a single click (in the other application) to open the right OneNote notebook.  The constraint being this local use of OneNote could preclude the use of the cloud search.  Unless we can implement a syncing of our local structure to the OneDrive cloud just to take advantage of the search.

  • Anonymous
    January 28, 2015
    Does it also searches within the attached documents like PDFs?

  • Anonymous
    January 29, 2015
    Hi Aman. Unfortunately, searching attachments is not currently supported. It's on our list of requested features but we don't have an ETA at this point.  

  • Anonymous
    May 24, 2015
    Hi Is there a way to search on premise versions of onenote - our current security does not allow cloud based onenote files to be accessed and therefore we have the files on a shared drive. I want to be able to use an API from another applicatrion to search a onenote file on a file share. Thanks Darryl

  • Anonymous
    September 02, 2015
    How do I opt out of this API?

  • Anonymous
    September 16, 2016
    Can we search "data-tag" across pages ?? If yes then how can we do that ?