Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

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 static string AutoHyperlinking(
	string value
)

Parameters

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);
Console.WriteLine(htmlText);

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>.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.