将 Url 和一个纯文本字符串转换为 HTML 编码的字符串中的超链接中的电子邮件地址。
命名空间: Microsoft.SharePoint.Utilities
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Shared Function AutoHyperlinking ( _
value As String _
) As String
用法
Dim value As String
Dim returnValue As String
returnValue = SPUtility.AutoHyperlinking(value)
public static string AutoHyperlinking(
string value
)
参数
value
类型:System.String一个字符串,包含纯文本。
返回值
类型:System.String
HTML 字符串,包含与嵌入的 Url 和转换为超链接的电子邮件地址的字符串的原始编码的版本。
备注
此方法搜索的任何 Url 或电子邮件地址中指定的字符串,并将它们转换为 HTML A标记。
示例
下面的示例是一个控制台应用程序转换为两个超链接的 URL 和电子邮件地址的一部分。
string plainText = "For more information on "Sample Product", see https://www.microsoft.com or e-mail someone@microsoft.com.";
string htmlText = SPUtility.AutoHyperlinking(plainText);
Console.WriteLine(htmlText);
该示例将生成以下输出。
For more information on "Sample Product", see <a href="https://www.microsoft.com">https://www.microsoft.com</a> or e-mail <a href="mailto:someone@microsoft.com">someone@microsoft.com</a>.