use Python and an outlook: protocol URL to bring up a specific email

jkn jkn_gg at nicorp.f9.co.uk
Tue Jan 12 11:51:13 EST 2016


Hi all
    a little OS/windows specific, I'm afraid:

In Windows, there exists a part-supported 'outlook protocol' to obtain and use
email references within Outlook as URL. You have to go through various shenanagins to enable this and to get Outlook to give you access to the URLs - see for instance:

http://www.slipstick.com/problems/outlook-missing-outlook-protocol/
http://superuser.com/questions/834019/using-outlook-protocol-open-current-instance-of-outlook-not-new-instance
http://www.davidtan.org/create-hyperlinks-to-outlook-messages-folders-contacts-events/

Having gone through all of this I get a refernce URL on my clipboard or whatever:

"outlook:00000000BB1BBDFACA3A4D41A98037A1D85A8DA50700E6FBFC004227134D97632785EE69C220003C0208DEA10000DAC09B3B9C648E4597BE2A013A6E8B84000026F87CCA0000"

(This refers to a particular email in Outlook)

What I want to do is then use Python to invoke this URL to cause Outlook to
bring up the referenced email. I'm stumbling here; I've tried urllib.urlopen(),
and os.startfile(), but I am getting errors from urllib in either case:

    def open_unknown(self, fullurl, data=None):
        """Overridable interface to open unknown URL type."""
        type, url = splittype(fullurl)
        raise IOError, ('url error', 'unknown url type', type)

ie. the 'outlook' protocol is unknown. 

I happy to carve some code without using urllib, but I am not clear what I
actually need to do to 'open' such a URL using this protocol. FWIW I can paste
this URL into Windows Explorer and I get the referenced email popping up ;-)

Thanks for any pointers

    Regards
    Jon N




More information about the Python-list mailing list