SharePoint Links with Ampersands

967 views Asked by At

How do you link within SharePoint to a site that has an Ampersand in it's URL?

My goal was to get SharePoint to use an ID inserted into a field to link to a TFS item VIA the web interface for TFS.

1

There are 1 answers

0
Xenoranger On BEST ANSWER

I was trying to get my SharePoint Task List to point to TFS. The TFS URL uses the following format:

http://tfs.domain/tfs/site/Project/_workItems/index#_a=edit&id=13129

So, naturally, you'd think that you could just append {@TFS_x0020_Item_x0020_Number} to the end.

<a href="http://tfs.domain/tfs/site/Project/_workItems/index#_a=edit&id={@TFS_x0020_Item_x0020_Number}" target="_blank">

Sadly, this isn't so.

Instead, I had to use &amp; to get the desired output. My full code looked like this:

<a href="http://tfs.domain/tfs/site/Project/_workItems/index#_a=edit&amp;id={@TFS_x0020_Item_x0020_Number}" target="_blank">
<xsl:value-of select="@TFS_x0020_Item_x0020_Number"/> - Click to View
</a>

In the end, I was successfully able to link to TFS from Sharepoint.

I suspect this solution has uses for linking to other sites that include Ampersands (&) and other special characters.