jbrogdon
jbrogdon

Reputation: 671

What is the format for Outlook hyperlinks?

I am working on a utility to take a number (~80) of hyperlinks and convert them into a format that can be pasted into an Outlook email message--causing Outlook to only display a parameter from the URL for the link. The hyperlinks actual reference bugs in our bug tracking system. The hyperlinks only differ by the bug number parameter at the end of the URL. My plan is to have the utility push the Outlook formatted hyperlinks on the clipboard, so that they can be pasted into Outlook. The problem I have is: what is the format that Outlook expects to paste the hyperlinks in as described--with a single bug number as the visible text for the link? For reference, I'm planning on doing all this with Python.

Upvotes: 3

Views: 1450

Answers (1)

SliverNinja - MSFT
SliverNinja - MSFT

Reputation: 31651

Not sure about python implementation, but in c# you can use System.Windows.Forms.Clipboard to copy HTML-formatted text for rich text editors. See related SO post and HTML Clipboard Format on MSDN. Maybe using this reference link - you can convert this to a python-based approach.

private const string html = @"Version:0.9
StartHTML:<<<<<<<1
EndHTML:<<<<<<<2
StartFragment:<<<<<<<3
EndFragment:<<<<<<<4
SourceURL: {0}
<html>
<body>
<!--StartFragment-->
<a href='{0}'>{1}</a>
<!--EndFragment-->
</body>
</html>";

string link = String.Format(html, "http://www.stackoverflow.com", "StackOverflow");
Clipboard.SetText(link, TextDataFormat.Html);

Upvotes: 2

Related Questions