Advertisement
Guest User

Untitled

a guest
Jun 8th, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Evernote = require('evernote');
  2.  
  3. const noteID = 'b6401aaf-8b5d-491f-b9a3-18b6bac5840a'
  4. const token = '';
  5. const serviceHost = 'www.evernote.com.';
  6. const client = new Evernote.Client({ token, serviceHost });
  7. const noteStore = client.getNoteStore();
  8.  
  9. const newContent = `
  10. <!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
  11. <en-note>
  12.     <div>Updated Note</div>
  13. </en-note>
  14. `;
  15.  
  16. (async () => {
  17.   try {
  18.     const note = await noteStore.getNote(noteID, true, true, true, true);
  19.     console.log('Source content: ')
  20.     console.log(note.content);
  21.     note.content = newContent
  22.  
  23.     const updateDoc = {
  24.       guid: noteID,
  25.       title: note.title,
  26.       content: newContent
  27.     };
  28.  
  29.     await noteStore.updateNote(updateDoc)
  30.  
  31.     console.log('Updated content: ')
  32.     const updateNote = await noteStore.getNote(noteID, true, true, true, true);
  33.     console.log(updateNote.content);
  34.   } catch (e) {
  35.     console.log(e);
  36.   }
  37. })();
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement