0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SharePoint Client Object Model でリスト オブジェクトを取得するコード

Posted at
// コンテキスト取得
var custCtx = SP.ClientContext.get_current();
 
// サイトオブジェクト取得指示
var custWeb = custCtx.get_web();

// リスト(ライブラリ) オブジェクトの取得指示
var custList = custCtx.get_web().get_lists().getByTitle("(リスト・ライブラリの表示名)");
//// リストコンテキスト内のページ(ビュー、フォーム等)の場合に現在のリストを取得する場合
//var custList = custCtx.get_web().get_lists().getById(_spPageContextInfo.pageListId);

// リストオブジェクト取得予約
custCtx.load(custList);

// サーバーへのクエリー実行(ここまでのコンテキストに含まれる指示予約を送信)
custCtx.executeQueryAsync(
    function(sender, args) { // クエリー実行時コールバック処理
        console.log(custList);

        // ここで各種処理

    },
    function(sender, args) { // クエリー失敗時コールバック処理
        console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    }
);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?