SharePoint Ecma 获取列表属性

SharePoint Ecma Get List Properties

我正在尝试使用 SharePoint ECMA 读取列表属性,但未能成功。

任何人都可以提供帮助 - 这是代码 - 尝试使用方法 get_fieldValues 和 get_item 并且都返回了 "undefined".

var key = "vti_level";
function getListProperty() {
    var clientContext = new SP.ClientContext();
    var listGuid = GetUrlKeyValue('List', window.location.href);
    this.props = clientContext.get_web().get_lists().getById(listGuid).get_rootFolder();
    clientContext.load(this.props);
    clientContext.executeQueryAsync(Function.createDelegate(this, getListPropertySuccess), Function.createDelegate(this, getListPropertyFailed));
}

function getListPropertySuccess() {
    var propKey1 = this.props.get_properties().get_fieldValues()[key];
    var propKey2 = this.props.get_properties().get_item(key);
}

function getListPropertyFailed() {
    alert('Request failed on getListProperty.');
}

试试这个:

    var key = "vti_level";

        function getListProperty() {
            var clientContext = new SP.ClientContext();
            var listGuid = _spPageContextInfo.pageListId;
            this.props = clientContext.get_web().get_lists().getById(listGuid).get_rootFolder().get_properties();
            clientContext.load(this.props);
            clientContext.executeQueryAsync(Function.createDelegate(this, getListPropertySuccess), Function.createDelegate(this, getListPropertyFailed));
    }
    function getListPropertySuccess() {
        var propKey1 = this.props.get_fieldValues()[key];
        var propKey2 = this.props.get_item(key);
    }
    function getListPropertyFailed() {
        alert('Request failed on getListProperty.');
    }