SP へClientContext オブジェクト (sp.js)
サイトのユーザー カスタム アクションのコレクションを示す値を取得します。
**適用対象:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.ClientContext()
メンバー
ClientContextオブジェクトでは、次のメンバーがあります。
Constructor
ClientContextオブジェクトでは、次のコンスがあります。
コンストラクター |
説明 |
---|---|
Initializes a new instance of the ClientContext object for the specified SharePoint site. |
メソッド
ClientContextオブジェクトでは、次の方法があります。
メソッド |
説明 |
---|---|
Casts the specified client object to a derived type. |
|
Disposes of the context. |
|
Executes the current pending request asynchronously on the server. |
|
Retrieves the properties of a client object from the server. |
|
Retrieves an enumerable sequence of child client objects from the specified collection. |
|
Raises the ExecutingWebRequest event. |
|
Parses the specified JavaScript Object Notation (JSON) string and gets an object from it. |
プロパティ
ClientContextオブジェクトでは、次のプロパティがあります。
プロパティ |
説明 |
---|---|
Gets or sets the name of the runtime where the current client application is located. |
|
Gets the current client context of the client-side object model (CSOM) runtime. |
|
Gets or sets a value that indicates whether form digest handling is enabled. |
|
Gets a value that indicates whether the client context has a pending request. |
|
Gets the client request that is sent to the server when the next executeQueryAsync method is executed. |
|
Gets or sets the request timeout in milliseconds |
|
Gets the build version of Microsoft.SharePoint.Client.ServerRuntime.dll on the server. |
|
Gets the schema version of Microsoft.SharePoint.Client.ServerRuntime.dll on the server. |
|
Gets the version of the current instance of SharePoint 2013. |
|
Gets the site collection that is associated with the client context. |
|
Gets or sets the trace correlation ID used by the server. |
|
Gets the URL associated with the runtime context. |
|
Gets the website that is associated with the client context. |
注釈
コンテキストについては、現在の web アプリケーション、サイト、サイト コレクション、またはサーバー側のバージョンに戻るには、 ClientContextオブジェクトを使用します。
例
次の例では、SharePoint オブジェクト モデルにアクセスするためのクライアントのコンテキスト オブジェクトのインスタンスを作成します。例では、 currentプロパティを使用して、現在のコンテキストを取得します。
var clientContext;
var website;
// Make sure the SharePoint script file 'sp.js' is loaded before your
// code runs.
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
// Create an instance of the current context.
function sharePointReady() {
clientContext = SP.ClientContext.get_current();
website = clientContext.get_web();
clientContext.load(website);
clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
}
function onRequestSucceeded() {
alert(website.get_url());
}
function onRequestFailed(sender, args) {
alert('Error: ' + args.get_message());
}