Last active
December 15, 2015 19:48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get list of notebooks linked to this account | |
linkedNotebooks = noteStore.listLinkedNotebooks(authToken) | |
bizLinkedNotebook = None | |
# grab the first business notebook for use in this example | |
for lnb in linkedNotebooks: | |
if hasattr(lnb, 'businessId'): | |
# this links a business notebook to our user's account | |
bizLinkedNotebook = lnb | |
print "Choosing notebook: %s" % bizLinkedNotebook.shareName | |
break | |
if not bizLinkedNotebook: | |
print "No business notebooks linked with this account" | |
raise SystemExit | |
# Authenticate to the SharedNotebook | |
shareAuthResult = bNoteStore.authenticateToSharedNotebook(bizLinkedNotebook.shareKey, authToken) | |
# Capture authentication token for use in this instance | |
shareAuthToken = shareAuthResult.authenticationToken | |
# Get `Notebook` instance | |
sharedNotebook = bNoteStore.getSharedNotebookByAuth(shareAuthToken) | |
# create or modify a `Note` | |
myNote = Types.Note() | |
myNote.title = "I'm a test note!" | |
myNote.notebookGuid = sharedNotebook.notebookGuid | |
content = '<?xml version="1.0" encoding="UTF-8"?>' | |
content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">' | |
content += "<en-note>I'm the body of a test note!</en-note>" | |
myNote.content = content | |
# Create a new note in the business notebook | |
# if modifying an existing Note, call updateNote here | |
myNote = bNoteStore.createNote(bAuthToken, myNote) | |
print "New business note (GUID): %s" % myNote.guid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment