Does anyone know why I get
"Uncaught TypeError: list.getEnumerator is not a function"
in my OnSuccess() function?
This code worked fine before, when I tried to get the Titles of all lists in my site collection.
Now I want to get the titles of all rows assigned to John Doe, in my list called testIssues
.
What have I missed?
'use strict';
var clientContext = new SP.ClientContext.get_current();
var hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
var parentContext = new SP.AppContextSite(clientContext, hostweburl);
var parentWeb = parentContext.get_web();
var list = parentWeb.get_lists().getByTitle("testIssues");
var listItems;
$(document).ready(function () {
});
function VisaLista() {
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><Geq><FieldRef Name='p32c'/>" +
"<Value Type='User'>John doe</Value></Geq></Where></Query></View>");
listItems = list.getItems(camlQuery);
clientContext.load(listItems);
clientContext.executeQueryAsync(OnSuccess, OnFail);
}
function OnSuccess() {
var listString;
var listEnumerator = list.getEnumerator();
while (listEnumerator.moveNext()) {
var currentItem = listEnumerator.get_current();
listString += "<br/> " + currentItem.get_title();
}
$('#divAllaListor').html(listString);
}
function OnFail(sender, args) {
alert('Failed, Error:' + args.get_message());
}
function getQueryStringParameter(param) {
var params = document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == param) {
return singleParam[1];
}
}
}