Skip to content

Instantly share code, notes, and snippets.

@evernotegists
Last active December 17, 2015 17:39
Show Gist options
  • Save evernotegists/5647969 to your computer and use it in GitHub Desktop.
Save evernotegists/5647969 to your computer and use it in GitHub Desktop.
Create a simple note
- (void) makeNoteWithTitle:(NSString*)noteTile withBody:(NSString*) noteBody withParentNotebook:(EDAMNotebook*)parentNotebook {
NSString *noteContent = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
"<en-note>"
"%@"
"</en-note>",noteBody];
// Parent notebook is optional; if omitted, default notebook is used
NSString* parentNotebookGUID;
if(parentNotebook) {
parentNotebookGUID = parentNotebook.guid;
}
// Create note object
EDAMNote *ourNote = [[EDAMNote alloc] initWithGuid:nil title:noteTile content:noteContent contentHash:nil contentLength:noteContent.length created:0 updated:0 deleted:0 active:YES updateSequenceNum:0 notebookGuid:parentNotebookGUID tagGuids:nil resources:nil attributes:nil tagNames:nil];
// Attempt to create note in Evernote account
[[EvernoteNoteStore noteStore] createNote:ourNote success:^(EDAMNote *note) {
// Log the created note object
NSLog(@"Note created : %@",note);
} failure:^(NSError *error) {
// Something was wrong with the note data
// See EDAMErrorCode enumeration for error code explanation
// http://dev.evernote.com/documentation/reference/Errors.html#Enum_EDAMErrorCode
NSLog(@"Error : %@",error);
}];
}
@sohocoke
Copy link

This is linked from the documentation section on creating notes with attachments. It doesn't contain such details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment