Evernote / evernote-cloud-sdk-windows

79 stars 45 forks source link

Uploading notes using VBA #7

Open swbuehler opened 9 years ago

swbuehler commented 9 years ago

How do I call the upload function from VBA? All your documentation uses something OTHER than Visual Basic.

Sub MailtoEvernote()
    Dim en As New ENSessionForCOM
    Call en.SetSharedSessionDeveloperToken(devtoken, url)
    If en.SharedSession.IsAuthenticated = False Then
        Call en.SharedSession.AuthenticateToEvernote
    End If
    Dim enNote As New enNote, enNoteContent As New ENNoteContentForCOM
    enNote.Title = "This is a test note"
    enNote.Content = enNoteContent.NoteContentWithSanitizedHTML("<b>This</b> is a <i>test</i> Note.")
    Call en.SharedSession.UploadNote(enNote, "") ' <--This produces error.

    Set en = Nothing
End Sub
BonzoFestoon commented 7 years ago

I am having the same problem with this code as well:

Public Sub CreateNote(mailItem As Outlook.mailItem, url As String)

    If mailItem Is Nothing Then
        Exit Sub
    End If

    Dim evernoteSession As New ENSessionAdvancedForCOM
    Call evernoteSession.SetSharedSessionConsumerKey(Key, Secret, Host)

    If evernoteSession.SharedSession.IsAuthenticated = False Then
        evernoteSession.SharedSession.AuthenticateToEvernote
    End If

    Dim note As New ENNote
    note.title = mailItem.Subject

    Dim noteContent As New ENNoteContentForCOM
    note.content = noteContent.NoteContentWithSanitizedHTML(mailItem.HTMLBody)

    Call evernoteSession.SharedSession.UploadNote(note, Nothing) <-- Bang

End Sub

The error is 80131500 Evernote.EDAM.EDAMNotFoundException