Welcome to Decode the Code. This is a programming web site dedicated to web development, developer resources, web design, programmer tools, source code repository, custom DLL, databases and more programming related stuff. HTML, CSS, Javascript, ASP and ASP.NET are a few of the things that you might read about on this site.






Google

  Blogs     Google Tech News     Digg News     NASA TV     Pentagon Channel  

My Two Bits Worth

Joshua Carroll, Chief Software Architect

OT: Adding URL's to email messages

7/13/2008 9:29:00 AM

I recently received a question from a co-worker about inserting URL's into emails.  Although this isn't a normal topic of this site, I thought others might find it useful as well.

 


Josh,
I have a quick question. I am interested in how you made this a link. 
I have copied and pasted the info but never been able turn it into a link.
Can you help me?

file://P:/Information%20Technology%20Training%20Center\Public\SIAC%20Files\20
08-02-20%20Master%20Instructor%20rings.wmv

V/R,
Dana


 

Absolutely!  Take the red pill and follow me down the rabbit hole...

Outlook will automatically create a link for any valid URL (Uniform Resource
Locator) that you type into an email.  By definition, every URL must start with a protocol.  The most common example of a protocol is seen in your address bar while surfing the Internet: http.  Other examples of protocols include https, mailto, callto and file.

In regards to the last one, let's say you want to create a URL that sends people to:

P:\Information Technology Training Center\Public\SIAC Files\

Keep in mind that the example above is not yet a URL, but it is only a file path.  In order to create a URL from this path, the first thing you need to do is add a protocol at the beginning, like so:

file://P:\Information Technology Training Center\Public\SIAC Files\

Now you can see that the link was created, but it stops after the word "Information".  This is not an error.  This is because of another standard in URL's which states that there can be no spaces in a URL.  There are a couple of ways that we could remove the spaces from this URL:

1. Rename the folders and files from "SIAC Files" to "SIAC_Files", etc.
2. Encode those spaces in our URL into Unicode.

The first option could be a major pain, and probably isn't worth the time, so let's look at the second option.  While it might sound scary at first, encoding spaces into Unicode is very easy.  Simply replace all of the spaces in the URL with %20.  By doing this to our URL, it comes out looking like
this:

file://P:\Information%20Technology%20Training%20Center\Public\SIAC%20Files\

And, viola, we have a properly formatted URL!  Outlook, having realized this, has created the link for us.

See... It might be a long rabbit hole, but it's not scary.  ;)

 

Leave a comment
View previous articles


Join WebHost4Life.com


Have a tech related question?  Send your question to us via our contact form.  We will try to answer all questions, and yours may be selected to be featured on this page.


There is currently 1 other visitor on this site.

Contact Us  |  Privacy Statement