I am trying to use this method to query items of a column of a list in my SP site via javascript (the reason I am doing this is to display that info on the page by modifying the html tags in the DOM), but I am only able to query the "ID" column of my list, which is a Picture Library. The column I want is actually a Text column titled "Link to Page", but it is throwing the following error

"The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."

Here are the relevant sections of code that I am using:

function retrieveListItems() {

var newLinks = [];

    var clientContext = new SP.ClientContext.get_current();

    var oList = clientContext.get_web().get_lists().getByTitle('ListName');

    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Link to Page\'/></OrderBy></Query></View>');

    this.collListItem = oList.getItems(camlQuery);


    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));        

    return newLinks;

function onQuerySucceeded(sender, args) {

    var listItemEnumerator = collListItem.getEnumerator();

    var itemCount = collListItem.get_count();

    var newLinks = new Array(parseInt(itemCount) - 1);

    alert("array length: " +  newLinks.length);

    while (listItemEnumerator.moveNext()) {

        var oListItem = listItemEnumerator.get_current();

        newLinks[i] = oListItem.get_item('Link to Page');

function onQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

$(document).ready(function() {ExecuteOrDelayUntilScriptLoaded(retrieveListItems,"sp.js");});

I thought my problem might be similar to this post but that solution doesn't seem to be working for me. I'd be grateful for any pointers on this!


You should use the Internal Name of the column, so its probably:


Easy way to check the internal name is from the url when you edit the column, and check the "Field=" part of the URL:


Replace %5F with underscore, or just paste the url into a url decoder tool

  • I was going to mention in my question that I had a suspicion that it might be the whitespace causing the problem. I will try this out and get back, thanks. – Alex Feb 28 '13 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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