Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves an encoded version of the specified JavaScript string.
Namespace: Microsoft.SharePoint.Client.Utilities
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
Public Shared Function EcmaScriptStringLiteralEncode ( _
scriptLiteralToEncode As String _
) As String
'Usage
Dim scriptLiteralToEncode As String
Dim returnValue As String
returnValue = HttpUtility.EcmaScriptStringLiteralEncode(scriptLiteralToEncode)
public static string EcmaScriptStringLiteralEncode(
string scriptLiteralToEncode
)
Parameters
scriptLiteralToEncode
Type: System.StringA string representation of the JavaScript string to encode.
Return Value
Type: System.String
A String that contains the encoded version of the JavaScript string.
Remarks
Ecma International develops standards for information and communication systems. For more information, visit http://www.ecma-international.org/.
Examples
This code example encodes the URL of the All Tasks View of the specified site.
using System;
using Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointFoundation.Samples
{
class HttpUtility_EncodeExample
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
Web site = clientContext.Web;
List targetList = site.Lists.GetByTitle("Tasks");
View targetView = targetList.Views.GetByTitle("All Tasks");
clientContext.Load(targetView);
clientContext.ExecuteQuery();
String relativeUrl = targetView.ServerRelativeUrl;
String encodedUrl = Microsoft.SharePoint.Client.Utilities.HttpUtility.EcmaScriptStringLiteralEncode(relativeUrl);
Console.WriteLine("Encoded All Tasks View URL: {0}", encodedUrl);
}
}
}