Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/458.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
Javascript 如何使用Java获取SharePoint SPListItem字段值?_Javascript_Sharepoint - Fatal编程技术网

Javascript 如何使用Java获取SharePoint SPListItem字段值?

Javascript 如何使用Java获取SharePoint SPListItem字段值?,javascript,sharepoint,Javascript,Sharepoint,如何在Java中获取SPListItem的字段“值” 我已经设法查询了我想要的列表中的项目,这里是我的CAML代码: var query = new SP.CamlQuery(); query.set_viewXml("<View><Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>Main</Value></Contains

如何在Java中获取SPListItem的字段“值”

我已经设法查询了我想要的列表中的项目,这里是我的CAML代码:

var query = new SP.CamlQuery();
query.set_viewXml("<View><Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>Main</Value></Contains></Where></Query></View>");
this.groupItems = list.getItems(query);
var query=new SP.CamlQuery();
set_viewXml(“Main”);
this.groupItems=list.getItems(查询);
现在我有了项目,下一步是什么?

共享答案:

第一:

//get context
var context = new SP.ClientContext.get_current();
//open web
var web = context.get_web();
//get list
var list = web.get_lists().getByTitle('yourListName');

var query = new SP.CamlQuery();
query.set_viewXml("<View><Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>Value</Value></Contains></Where></Query></View>");
//query to get item 
this.groupItems = list.getItems(query);

context.load(this.groupItems);
context.executeQueryAsync(Function.createDelegate(this, this.xmlSuccess), Function.createDelegate(this, this.xmlFailure));
最后:

//loop your items you get
for(idx in storeAll)
{
    //do your code here with the items
}
希望这能帮助别人

//loop your items you get
for(idx in storeAll)
{
    //do your code here with the items
}