Partilhar via


Page Query and Full Text Search

Hi All,

As my colleague Gareth announced earlier today, you can now use Query Pages and Full Text Search in production. We think this unlocks a lot of interesting scenarios for OneNote developers.

While unchanged at the core, we tuned a few things here and there based on the feedback we received. If you are a Beta user, please take a look at the list of changes below as you might need to update your app accordingly. 

Query Pages: What’s changed since the Beta?

Added “lastModifiedTime” as property to the page object
You can now use this property to:

  • Display a list of recently modified notes in the UI of your App
  • Synchronize new and/or updated pages in the server with your App’s local storage
  • Scope search queries to pages modified in the last month

Changed the default ordering of pages from most recently created to most recently modified
We believe most page query scenarios would benefit from this new default ordering. Of course, you can still sort results using any other field.

Increased max page size to 500 results
The default page size continues to be 20 but now you can request up to 500 results in one call. E.g. https://www.onenote.com/api/v1.0/pages?top=500

Performance improvements
We improved performance for users who have a large number of pages.

Support for $count
We now support the OData $count verb so you can get the total number of pages in the collection. Good for paging. E.g. https://www.onenote.com/api/v1.0/pages?count=true

(Coming soon) Support for querying pages in notebooks shared by other users
For this initial release, we don’t support querying pages under notebooks the user is not the owner of. However, we’ve already started working on it and will be available within the next few months. Shared notebook support is coming to full text search as well. So for now, query requests for pages under notebooks the user is not the owner of will return zero results.

(Coming soon) Support for $expand
Support for expand is coming to pages so you can request information about the parent notebook and the parent section of a collection of pages in a single round trip. In the meanwhile you can enumerate pages under a section using the following url:

https://www.onenote.com/api/v1.0/sections/{id}/pages
 

Full Text Search: What’s changed since the Beta?

Search API is now available broadly for all OneNote users in OneDrive
We incorporated Bing as a search technology into the OneNote API so your apps, when granted access by the user, can search OneNote content on their behalf. Content in the index is private and can only be accessed by the notebook owner.

Improved relevance
We have improved result relevance since the Beta and we will continue to improve it over time.

And there you have it. For more details and examples please refer to our MSDN documentation. Additionally, you can quickly get started by trying your own queries in our interactive developer console.

We are excited about the new range of experiences you can build on top of OneNote using the API. A few I’m particularly enthused about:

1)   OneNote as a source for contextual notes and memories. Your app can now surface relevant notes for the user at the right time. For instance:

  • A cookbook app can bring up Amy’s grocery list stored in OneNote and automatically add any missing ingredients so she doesn’t forget to buy anything at the grocery store.
  • A travel app for the phone can use the search API to look for recent pages with “car rental confirmation number” and, based on the user’s location, display a toast notification that brings the page into context. 

2)   A retail app can use the search API to suggest good deals based on a user’s shopping lists or product clippings in OneNote. Similarly, a restaurant app can suggest new trending restaurants based on the recipes a user has clipped to OneNote.

3)   Build a page picker that allows users to select a page under a specific location and display its contents.

 

Happy coding,

-Omar

Comments

  • Anonymous
    February 27, 2016
    Did you remove the support for top 500? {  "error": {    "code": "20129",    "message": "The limit of '100' for the $top query has been exceeded. The value from the incoming request is '500'.",    "@api.url": "aka.ms/onenote-errors  } }