I get this error error: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. it has a problem in sp.runtime.js

$(window).load(function () {

    jQuery("div#NBSinboxsent").find(".itemid").each(function () {
        var itemid = jQuery(this).text();

        SP.SOD.executeFunc('sp.js', 'SP.ClientContext', NBSFeedbackEditInbox.FeedbackRemove.removemessage(itemid));

which then goes in to this :

NBSFeedbackEditInbox.FeedbackRemove = (function () {
    var listItemEnumeratorlistFeedback,
    removemessage = function (getid) {

        NBSFeedbackEditInbox.siteURL = _spPageContextInfo.siteAbsoluteUrl + '/Community/News-and-feedback/Feedback';
        var clientContext = new SP.ClientContext(NBSFeedbackEditInbox.siteURL);
        var oList = clientContext.get_web().get_lists().getByTitle('Feedback Items');
        getid = getid.substring(getid.lastIndexOf('#') + 1);
        getid = Math.round(getid);
        var query = SP.CamlQuery.createAllItemsQuery();
query.set_viewXml("<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='ID'/><Value Type='Integer'>"+getid+"</Value></Eq></Where></Query></View>");
        collListItems = oList.getItems(query);
        clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
    onQuerySucceeded = function () {
        var itemTitle=[];
        listItemEnumeratorlistFeedback = collListItems.getEnumerator();
        while (listItemEnumeratorlistFeedback.moveNext()) {

            feedbackListItem = listItemEnumeratorlistFeedback.get_current();

I am trying to get an individual element that is a list given the id. The list is a set of folders in which are the items that I want to search to get the correct list item

There error is thrown just after collListItems.getEnumerator();

1 Answer 1


use clientContext.load(collListItems, 'Include(Title, Id)');

You need to explicitly set the properties you need to load of the list item collection.


  • clientContext.load(collListItems, 'Include(*)') How to do this ?
    – ameliapond
    Apr 7, 2016 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.