I'm trying to update a note in Evernote. I set a filter, get notes list and I can also change the note's title. But when I try to change note content, nothing happens.
from evernote.api.client import EvernoteClient
import evernote.edam.type.ttypes as Types
from evernote.edam.notestore.ttypes import NoteFilter, NotesMetadataResultSpec
client = EvernoteClient(token="xxxxx", sandbox=True)
note_store = client.get_note_store()
updated_filter = NoteFilter(words='abaco')
result_list = note_store.findNotesMetadata(updated_filter, 0, 10000, NotesMetadataResultSpec(includeTitle=True))
for note in result_list.notes:
print "----- TITLE -----\n%s\n----- GUID -----\n%s\n----- CONTENT -----\n%s" % (note.title, note.guid, note_store.getNoteContent(note.guid))
note.title = "pippo"
note.guid = note.guid
note.content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
note.content += '<en-note>Note updated</en-note>'
note = note_store.updateNote(note)
I receive no error but the note is not updated.
I'm using Python 2.7.
Thanks in advance!
The return value of NoteStore#findNotesMetadata is NotesMetadataList that contains NoteMetadata, not Note object. In order to update notes, you should call NoteStore#getNote first, update the field and call NoteStore#updateNote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With