Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# js和sharepoint上的小Q_C#_Javascript_Jquery_Asp.net_Sharepoint - Fatal编程技术网

C# js和sharepoint上的小Q

C# js和sharepoint上的小Q,c#,javascript,jquery,asp.net,sharepoint,C#,Javascript,Jquery,Asp.net,Sharepoint,一个关于js和sharepoint交互的简单问题 我在asp页面中创建了一个js以从sharepoint检索列表项,我这样写: $(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(find, "sp.js"); }); window.onload = function () { find(); } function loadConstants() { var clientContext = new

一个关于js和sharepoint交互的简单问题

我在asp页面中创建了一个js以从sharepoint检索列表项,我这样写:

$(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(find, "sp.js"); });
 window.onload = function () {
 find();
}
function loadConstants() {     
    var clientContext = new SP.ClientContext.get_current(); ;
    this.web = clientContext.get_web();     
    var lists = web.get_lists();
    var list = lists.getByTitle("Weekend's Notes");
    var camlQuery = new SP.CamlQuery();
    this.items = list.getItems(camlQuery);
    clientContext.load(items);     
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

}
下面是查找方法

function onQuerySucceeded(sender, args) {
        var listItemInfo = '';
        var listItemEnumerator = collListItem.getEnumerator();
        while (listItemEnumerator.moveNext()) {
            var oListItem = listItemEnumerator.get_current();
            //document.getElementById("ctl00_m_g_826af611_885a_4a36_8141_91157fa66535_ctl00_TextArea1").innerHTML = oListItem.get_item('Note');

        }
    }
每次刷新浏览器时,它都显示它未捕获类型错误:无法读取未定义的属性“get\u current”
谁能帮我一把吗?对此完全没有想法…

似乎是在创建ClientContext之前运行了脚本。看看这是否有帮助:


哪一行抛出错误??错误与行号一起出现。你看,行号告诉我们错误发生在哪一行,这样我们就不必勉强/偶然/幸运地找到那个位置。不管怎样,行号Y在这里会很有用,所以如果你不介意检查错误发生在哪一行,我们将非常感激
:P
C#、ASP.NET和jQuery在这里起到了什么作用?大家好,我感谢你们的快速回复,问题是,这是我导入sp.js的合适方式吗?Caz我对此进行了测试,甚至没有调用函数constants()