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.