Home » Questions » Computers [ Ask a new question ]

Can I create a link to a specific email message in Outlook?

Can I create a link to a specific email message in Outlook?

I use Outlook as my email client at work, but I don't want to use it to manage my tasks and todos. (Instead I use plain text files and Emacs org-mode.) Since many todo items start out as mails in my inbox, I often need to reference these mails.

Asked by: Guest | Views: 241
Total answers/comments: 5
Guest [Entry]

"You can do this with a little bit of code in Outlook and a little bit of code in Emacs.

First, if you're using Outlook 2007 you'll need to enable Outlook URLs with a registry addition. Instructions and the registry file can be found here courtesy of David Tan.

Next, this macro can be added to Outlook and will get the GUID of the current email message, create a Org-Mode link and deposit it into the clipboard.

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

Dim objMail As Outlook.MailItem
Dim doClipboard As New 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 ""[[outlook:"" + objMail.EntryID + ""][MESSAGE: "" + objMail.Subject + "" ("" + objMail.SenderName + "")]]""
doClipboard.PutInClipboard

End Sub

As koushik noted in the comments, the doClipboard.SetText part can be expanded to differentiate between different item types:

If objMail.Class = olMail Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][MESSAGE: "" + objMail.Subject + "" ("" + objMail.SenderName + "")]]""
ElseIf objMail.Class = olAppointment Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][MEETING: "" + objMail.Subject + "" ("" + objMaildotorganizer + "")]]""
ElseIf objMail.Class = olTask Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][TASK: "" + objMail.Subject + "" ("" + objMail.Owner + "")]]""
ElseIf objMail.Class = olContact Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][CONTACT: "" + objMail.Subject + "" ("" + objMail.FullName + "")]]""
ElseIf objMail.Class = olJournal Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][JOURNAL: "" + objMail.Subject + "" ("" + objMail.Type + "")]]""
ElseIf objMail.Class = olNote Then
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][NOTE: "" + objMail.Subject + "" ("" + "" "" + "")]]""
Else
doClipboard.SetText ""[[outlook:"" + objMail.EntryID + ""][ITEM: "" + objMail.Subject + "" ("" + objMail.MessageClass + "")]]""
End If

Almost there, add this little bit of lisp to your emacs lisp directory to enable Outlook links.

;;; org-outlook.el - Support for links to Outlook items in Org

(require 'org)

(org-add-link-type ""outlook"" 'org-outlook-open)

(defun org-outlook-open (id)
""Open the Outlook item identified by ID. ID should be an Outlook GUID.""
(w32-shell-execute ""open"" (concat ""outlook:"" id)))

(provide 'org-outlook)

;;; org-outlook.el ends here

And lastly, update your .emacs file to include the Outlook link code. Just add this somewhere after org-mode is setup.

(require 'org-outlook)

Now you can call the macro (I added it to my toolbar in Outlook for quick access) and you can quickly create a link to the email in Emacs.

One gotcha, GUID's change when you move a message between document stores, so if you get the GUID to the message while it's on your Exchange server and then move it to your local PST file the link will change. Move the message before you get the GUID."
Guest [Entry]

"came across Linker applet.going to try it out..you may want to as well
http://www.teamscope.com/otherpro/utilities.asp#linker

Here's the marketing drible..

Linker™ for Windows® creates hyperlinks to items and folders in Outlook, and to files and folders in Windows Explorer. It is a system tray applet places the hyperlink in the Windows clipboard. The hyperlink can then be pasted into any Microsoft Office document, web page, e-mail message, or any document that supports hyperlinks.

Greetings from sunny South Africa!"
Guest [Entry]

"I prefer to copy the Outlook Item content to the system clipboard and then yank it into an Org-mode note.

http://www.emacswikidotorg/emacs/PlannerModeContrib#toc10"
Guest [Entry]

"You can copy an Outlook e-mail to OneNote (comes in as a yellow letter icon), then right click and select 'link to paragraph', and then paste the link into another document that can work with links.

But anyway, Microsoft should have made this whole thing of linking to an e-mail a standard feature. It was such a useful feature of Lotus Notes."
Guest [Entry]

Not without some kind of custom code. The Outlook URI's can get you to the containing folder within Outlook, but that's about it. You would need to come up with a clever filing strategy that aligned with your linking strategy to get more granular.