Share via


SPUtility.ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls Method (String, Boolean)

Converts the specified relative URL with an embedded prefix to a server-relative URL and optionally encodes the site prefix.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls ( _
    value As String, _
    ecmaScriptStringLiteralEncode As Boolean _
) As String
'Usage
Dim value As String
Dim ecmaScriptStringLiteralEncode As Boolean
Dim returnValue As String

returnValue = SPUtility.ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls(value, _
    ecmaScriptStringLiteralEncode)
public static string ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls(
    string value,
    bool ecmaScriptStringLiteralEncode
)

Parameters

  • ecmaScriptStringLiteralEncode
    Type: System.Boolean

    true to encode the site prefix; otherwise, false.

Return Value

Type: System.String
Returns a String representation of the server-relative URL.

Remarks

This method converts a URL with the prefix "~site/" or "~sitecollection/" to a server-relative URL.

See Also

Reference

SPUtility Class

SPUtility Members

ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls Overload

Microsoft.SharePoint.Utilities Namespace