Performing a basic search of a user’s Evernote account involves three steps:
NoteFilter
NoteStore.findNotesMetadata
NoteStore.getNote
for any notes that match the search.NoteFilter
offers several members that can be populated depending on the type of results you’re looking for:
words
— send a text-based search query (e.g.,“notebook:foo tag:bar”).notebooksGuid
— restrict the search results to a single notebook identified using it’s Notebook.guid
value.tagGuids
— limit your search results to only those notes that are assigned these tags (represented as a collection of Tag.guid
strings).inactive
— marking this member as true
will return only inactive notes (notes in the Trash, in other words). If left as false
— the default value — only active notes will be returned.NoteStore.findNotesMetadata
takes five parameters, in this order:
NoteFilter
findNotes
.NotesMetadataResultSpec
, which allows the user to define which information should be returned for each matching note. Essentially, this object's members are all boolean values (see the linked page for more details).
If we wanted to retrieve the titles of the 100 newest notes in an account, our code might look like this:
As you can see, we create an instance of NoteFilter
and set the ascending
member to False
(so the results are returned in descending order), set our offset to 0 and our limit to 100. If this query results in less than 100 notes, all matching notes will be returned. By setting includeTitle
to True
in our instance of NotesMetadataResultSpec
(and leaving the remaining values as False
), we ensure that unnecessary data isn't returned.
findNotesMetadata
returns a type we haven’t yet seen: NotesMetadataList
. Feel free to peruse the documentation for this type if you want to learn about everything it contains. In this example, we want to see which notes are returned — those can be find by querying NotesMetadataList.notes
:
When run, that code will echo the GUID and title of each matching note to the console.
After using NoteStore.findNotesMetadata
to identify which note or notes you'd like to download in their entirety, you can call NoteStore.getNote
, which returns an instance of Types.Note
, for each note to download the note body, attached files (Resource
s), and recognition information.
Core Concepts
Authentication
Rate Limits
Notebooks
Attachments
Search
Business