First trial to create note from Outlook

This is just an example I've made. In one of the above posts I've already added a link to the docs for the MailItem props. You can add to your script whatever you like to see.

A screenshot and corresponding JSON might help. Note that /folders return a tree of folders so sub-folders won't be at the root.

I tried today and works fine :slight_smile:
Would you try and confirm?

Don`t know why, I did not change anything, but no I can select all my notebooks. Strange, but it works:)

Thank you very much for this great plugin. It works like a magic, but can be nicer if the two places can be improved (in my opinion):

  1. The attached file of the email will not be imported to Joplin (no matter pdf or photos), don't know if I missed something here?
  2. It will pop up folder selection for each file when I have many files to be imported to Joplin. It can be nicer if only one selection is asked for one import action (no matter how many files are going to be imported to Joplin) .

How do I find the sToken for Joplin? I can't seem to find any answers here or through Google. Can someone help?

Tools > Options > Web Clipper there you can find the Token.

Thanks! But even using that token, I can't seem to get this to work. Not surprising since VBA/code/json are all completely alien to me. I pasted the "SendtoJoplin" code into ThisOutlookSession in VBA. And I imported the json.bas so that it shows up under Modules. And I added a shortcut to the macro in the Quick Access Toolbar in Outlook (2019). But when I click on the shortcut, nothing happens. Did I miss something or make a common error that I'm not aware of?

Have you put the parent_id of your notebook into the field it should be? You can find the parent_id in you cloud drive fold, for instance i use onedrive. I find one parent_id in one of my *.md files that are stored in my Onedrive fold.

I make it worked yesterday, but it suddenly doesn't work, don't know why. Strange to me.

I use Dropbox to sync, but can you tell me how to find the parent_id?
Never mind. I found it. But I must not be placing it in the right place. Can someone show me exactly where I should put the parent_id?

Have you found how to make it works ?
I'm curently at the same stage than you : pasted code, imported json.bas, added token, added button in QAT, and I get no result when clicking on it.

When I try to debug the macro, it stops immediately (first line) with the message : "Error 424 : object not found".

What did I miss ?

Sorry, but I can't help you. I haven't figured out how to get it to work.

Have used this plugin for over a year now, but since Joplin upgraded to 2.3 or so (where the sToken changed mysteriously) now it does not work.

Yes, I updated the sToken. But it doesn't really find any folders. I only get a choice of 0 and 1 and whatever that means it doesn't save to any Joplin folder?

Did the API change? @rami.sedhom are you still using it?

OK, I can find the notes. They do seem to be imported into Joplin, but I cannot find under which NoteBook they lie (I can search and find them, but they do not show up under any single notebook I created. They seem hidden until I search for them. Adding a screen shot from the actaul pop up asking to choose a Notebook ("from 0 to 1")

@rami.sedhom i use this code on the regular every day, and my workflow wouldn't work, or flow, without. I wanted to take a moment and give a massive thank you for putting it together.

i dabble in vba, so can adjust the code marginally by myself, but haven't had any luck in being able to change the stored note as a to-do, rather than a straight note. Has anyone had any success/any hacks to be able to do this? i send all my emails straight to an Inbox folder in joplin, and the first thing I do to each note is make them all to-dos.

I have no idea about VBA or Outlook, but maybe a hint about the API helps. There is a query parameter called is_todo (API reference). It needs to be set when creating the note.

You could try to add is_todo: 1 just like adding title, parent_id and body_html (not sure how the quotation marks should be).

1 Like

Using this successfully. I have removed the choice of folders as I always want new notes in my Inbox folder.

Has anyone looked into extending this to handle attachments? My VBA skills fall well below what I would trust to do this. Quite a lot of the emails I want to save have attachments and I would really like them to be sent across as well.

Yep, this did it. H E R O
A puzzling number of quotes and double quotes, but thanks so much for your insight!

For those wondering, here's my updated Send command:

With CreateObject("MSXML2.XMLHTTP")
            .Open "POST", sURLNotes, False
            .Send "{ ""is_todo"": 1, ""title"": """ & objItem.ConversationTopic & attachmentName & """" _
            & ", ""parent_id"": """ & sFolderID & """" _
            & ", ""body_html"": """ & sEscapedBody & """" _
            & " }"
1 Like

So i use a combination of the Hotfolder Plugin and a very rudimentary VBA function to save the attachments to a location on my harddrive and let the plugin do the rest. I then call this function from inside @rami.sedhom 's original code - i should probably check to see if there are attachments before calling it, but like i said, rudimentary.

I set up a global variable called attachmentName, which I use to append to the title of the note that's created in Joplin, so i can more easily determine which notes to merge when I get there. The end result looks like this, although in writing this out I've just this second realised this doesn't handle multiple attachments well at all and my guess is it will just take the name of the last attachment on the email.


Hope this is helpful

Option Explicit

Dim attachmentName As String
Public Function sendAttachmentToJoplin(mItem As Variant)

Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String

sSaveFolder = ' location of your hotfolder

On Error GoTo ErrorMess2

For Each oAttachment In mItem.Attachments
        'Debug.Print oAttachment.DisplayName;
        oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
        attachmentName = " (" & oAttachment.DisplayName & ")"
Next oAttachment

Exit Function

    Debug.Print "ERROR: "; mItem.ConversationTopic; " 02"

End Function

EDIT: I should also say, this includes all those irritating picture people put in their signatures too. And I'm not sure if it's to do with how I'm exporting them from outlook, or how the hotfolder plugin brings them in, but they come in as complete gobbledygook.

In case you are still interested in adding attachments, I got this working by directly uploading the attachments as Joplin resources (rather than using the Hotfolder plugin). It then adds a link to the attachments at the start of the email in Joplin.

I developed this in a new version of this macro, available from here: Outlook Notes to Joplin ยท GitHub .

1 Like