SPUtility.AutoHyperlinking method

Converts URLs and email addresses in a plain text string into hyperlinks in an HTML-encoded string.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Public Shared Function AutoHyperlinking ( _
	value As String _
) As String
Dim value As String
Dim returnValue As String

returnValue = SPUtility.AutoHyperlinking(value)


Type: System.String

A string that contains plain text.

Return value

Type: System.String
An HTML string containing an encoded version of the original string with embedded URLs and email addresses converted into hyperlinks.

This method searches for any URLs or email addresses in the specified string and converts them into HTML A tags.

The following example is part of a console application that converts a URL and an email address into two hyperlinks.

string plainText = "For more information on "Sample Product", see http://www.microsoft.com or e-mail someone@microsoft.com.";
string htmlText = SPUtility.AutoHyperlinking(plainText);

The example produces the following output:

For more information on &quot;Sample Product&quot;, see <a href="http://www.microsoft.com">http://www.microsoft.com</a> or e-mail <a href="mailto:someone@microsoft.com">someone@microsoft.com</a>.