Integrating MS Outlook with Dynalist (similar to Todoist)

This might be helpful for anyone who works with MS Office/Outlook and wants to be able to link specific Outlook emails to Dynalist (this of course is not an issue for anyone who lives in a Gmail world, as you can just copy/paste the email url either manually or using the clip extension that @rawbytz just posted here ).

This is helpful if you are tracking your tasks or notes in Dynalist, and want to add a link to a particular email that contains some pertinent info or to which you need to reply or that you need to follow up on. Todoist Outlook Add-In does this very well, for instance, but for those who want to keep track of this in Dynalist or who do not want to rely on Outlook native flagging/task manager, here is the VBA code that you can use to create 2 macros:

 '(1) Adds a link to the currently selected message to the clipboard
Sub Get_Link()

   Dim objMail As Outlook.MailItem
   Dim doClipboard As New MSForms.DataObject

   'One and ONLY one message muse be selected
   If Application.ActiveExplorer.Selection.Count <> 1 Then
   MsgBox ("Select one and ONLY one message.")
   Exit Sub
   End If

   Set objMail = Application.ActiveExplorer.Selection.Item(1)
   doClipboard.SetText objMail.Subject + " / __outlook link:__ " + objMail.EntryID
   doClipboard.PutInClipboard
   MsgBox ("Copied to Clipboard")

    End Sub

'(2) Opens link from the clipboard
Sub Open_Email()

    Dim myOlApp As Outlook.Application
    Dim myNamespace As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Dim myMail As Outlook.MailItem
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")

    Dim objData As New MSForms.DataObject
    Dim strText

       objData.GetFromClipboard
       strText = objData.GetText()

'Enter EntryID
 
Set myMail = myNamespace.GetItemFromID(strText)

'Open message

myMail.Display

End Sub

The first macro pulls the subject and the unique email ID and copies it to your clipboard. You can then paste it into your Dynalist document.

To use the second macro, locate the email ID string in Dynalist, copy it and run the macro in Outlook. This will pull up the referenced email in Outlook.

For anyone who is not familiar with Outlook VBA, just go to “Developer” tab, select “Visual Basic”, then in the new window, expand the folders on the left until you see “This OutlookSession”. Copy the code above there. You need to also enable macros in “Macro Security” in the Developer tab, if not already enabled. Restart outlook after this.

Note that email ID in Outlook changes if you move the message to another folder, so run these macros after you have decided where the particular message will live (if you are using folders).

Note further that there is a way to enable Outlook URL in MS Office so that outlook would automatically open the message using the following URL outlook://messageID . You can tweak the first macro to make sure that the copied text looks like this. The main issue with this approach is that you need to tweak the registry on your PC to enable this, and most people who use Outlook do so at work and do not have the admin rights.

6 Likes

This is great, thank you!

This functionality looks great… anyone with an idea of something similar for Mac users? Or other strategies for integrating Outlook email with Dynalist?

When I was a Todoist user I found a script in a forum that worked great to link emails from Mac mail to tasks. I amb currently using this same script with Dynalist and it works fine.

The script is as follows:

tell application "Mail"
set theSelection to selection
set theMessage to first item of theSelection
set theUrl to "<" & message id of theMessage & ">"
set theUrl to do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of theUrl
set theUrl to "message://" & theUrl
set the clipboard to theUrl
end tell

Once you have created the script using the scripts editor, you can save it as “Copy message link” and include it in your scripts menu.

When you select a message in mail and run the script, a link to it will be copied in to your clipboard.

You can go then to Dynalist and copy it as a regular Dynalist link:

[name of the link](pasted mail link)

For further reference, here’s the link of the original forum where I found the instructions to create the script:

https://apple.stackexchange.com/questions/54981/copy-message-id-from-selected-message

It’s working fine for me. Hope it does for you too.

1 Like

Very cool. Thanks for sharing this, I’ll check it out!

Anyone have any ideas how to do something similar with Outlook 2016 for Mac?

I change the code a bit:

Additional tip
Put this macro to quick ribbon and access it via shortcut ALT than 3
Next ribbon open mail ALT than 4

Question: Anybody have macro to copy GRUD link to specific mail?
As opposed to ID, with GRUD You can open mail even if You change the folder. There is addon (Linker) which basically do this but I prefer personal macro

This VBA script needs the reference library, Microsoft Forms 2.0 Object Library(C:\Windows\System32\FM20.dll).

Which entry do you edit in registry?

Sorry, I don’t recall at this point, but there should be a few blogs that can help explain (if you search for VBA Outlook message ID, etc)

can someone outline just the most important benefits or helpfulness of connecting outlook with any given note/list/info-taking software?

Click a note link, and it opens the email. Then you can read it or reply. I think though Outlook is a bit wonky with this and it won’t be easy to code. MS OneNote doesn’t even do this.

Instructions to add a reference to the MS Forms 2.0 Object Library can be found here --> https://excel-macro.tutorialhorizon.com//vba-excel-reference-libraries-in-excel-workbook/

It’s for Excel but works exactly the same for Outlook once you’ve done Alt - F11 to access the VBA in Outlook. It’s been bugging me for ages not being able to create these Outlook links. They upgraded Outlook at work and all my existing Dynalist / Outlook links kept tripping up.

The above instructions fixed everything :grinning:

1 Like

Hi Rodion,

Do you mind to share how to open outlook://messageID and edit the win registry?

I use Hook to create links between a range of different things on my Mac(s). It works well with Outlook 2016. I’m not sure how well it does with “new Outlook” which I’ve been avoiding.

Hook can generate internal UUIDs and also Markdown links. It’s pretty great.

1 Like