3
7

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 のリスト列の情報を JavaScript で確認する

Last updated at Posted at 2017-04-23

ブログからの転載

作成したリストに追加した列情報を JSCOM (JavaScript Client Object Model) で取得するサンプル。

var ctx = new SP.ClientContext.get_current();
var fields = ctx.get_web().get_lists().getByTitle('<確認したいリスト名>').get_fields();

ctx.load(fields);
ctx.executeQueryAsync(
    function() {
        console.log('Successful get data of list fileds.');
        var fieldsEnum = fields.getEnumerator();
        while (fieldsEnum.moveNext()) {
            var field = fieldsEnum.get_current();
            if (!field.get_canBeDeleted()) {
                // 恐らく削除できない列はシステムが作成している
                continue;
            }
            console.log(field.get_title());                         // 列名
            console.log(field.get_internalName());                  // 列の内部名
            console.log(field.get_schemaXml());                     // スキーマ情報
        }
    },
    function(sender, args) {
        console.error("executeQuery Error. \n" + args.get_message());
    }
);

get_schemaXml で取得した情報である程度判る気がする。

3
7
1

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
3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?