1
votes

Trying to use OneNote API to search a page for a word with hashtag (e.g. #taskclone). This is producing an error from the API.

Link to Odata structure and syntax used by API - http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398071

I think the issue is related to the structure of the URL components in my query, which is why I added the second link. Would love an example of a working query including "#word".

UPDATE: Tried url encoding with /api/v1.0/me/notes/pages?search=%23taskclone, which caused no errors but gave a response back with no value:

{
  "@odata.context":"/api/v1.0/$metadata#me/notes/pages(parentSection(id,name,self))","value":[

  ]
}

Changing to/api/v1.0/me/notes/pages?search=taskclone works perfectly.

Here's the note text if it helps OneNote Page

2
Forgot to mention. Search for text without the hashtag work fineTroy Christmas
Do you need to escape or unescape the #?bated

2 Answers

0
votes

Make sure you are URL encoding the "search" query param:

This should work: https://www.onenote.com/api/v1.0/me/notes/pages?search=%23target This will not work: https://www.onenote.com/api/v1.0/me/notes/pages?search=#target

What kind of error are you getting back? What response code/response content?

0
votes

According to the current implementation OneNote Api should return same results for #taskclone and taskclone. We acknowledge the bug that #taskclone is returning 0 results. We are working on getting this bug fixed.

When the bug is fixed we will return same results for #taskclone and taskclone.