SPUtility.AutoHyperlinking-Methode

Wandelt URLs und e-Mail-Adressen in einer nur-Text-Zeichenfolge in Hyperlinks in eine HTML-codierte Zeichenfolge.

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

Syntax

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

returnValue = SPUtility.AutoHyperlinking(value)
public static string AutoHyperlinking(
    string value
)

Parameter

  • value
    Typ: System.String

    Eine Zeichenfolge, die nur-Text enthält.

Rückgabewert

Typ: System.String
Eine HTML-Zeichenfolge, die eine codierte Version der ursprünglichen Zeichenfolge mit eingebetteten URLs und e-Mail-Adressen in Hyperlinks umgewandelt.

Hinweise

Diese Methode sucht alle URLs oder e-Mail-Adressen in der angegebenen Zeichenfolge und konvertiert diese in HTML- A -Tags.

Beispiele

Das folgende Beispiel ist Teil einer Konsolenanwendung, die eine URL und eine e-Mail-Adresse in zwei Hyperlinks umwandelt.

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);

Das Beispiel erzeugt die folgende Ausgabe:

For more information on &quot;Sample Product&quot;, 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>.

Siehe auch

Referenz

SPUtility Klasse

SPUtility-Member

Microsoft.SharePoint.Utilities-Namespace