Troy Christmas
Troy Christmas

Reputation: 19

How do I search OneNote page for hashtag+word? (#text)

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

Upvotes: 1

Views: 1053

Answers (2)

Amol Natu
Amol Natu

Reputation: 151

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.

Upvotes: 0

Jorge Aguirre
Jorge Aguirre

Reputation: 2857

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?

Upvotes: 0

Related Questions