I have requirement which is

  1. Retrieve List Items in a List(list created through OOB)
  2. Display those list items on the sharepoint site by binding to repeator control
  3. Using javascript and client object model.

Steps I have done

  1. Created a new SharePoint Project
  2. Added a new Application Page to the project
  3. Wrote the below code

<script type="text/javascript">
    var ListItem;
    function GetListItems(listname, listItemId)
        var SPContext = new SP.ClientContext.get_current();
        var web=SPContext.get_web();

        var List=web.get_lists().getByTitle("Menu Items");
        ListItem = list.getItemById(listItemId);

    function GetListItemById_Successor(sender, args)
        var id = ListItem.get_id();
        var title = ListItem.get_item("Menu_Title");
        var Image = ListItem.get_item("Menu_Image");
        var Description = ListItem.get_item("Menu_Description");
        alert("Updated List Item: \n Id: " + id + " \n Title: " + title+ "\n Image:" +Image+ "\n Description:" +Description );
    function GetListItemById_Fail(sender, args)
        alert("GetListItemById Failed. \n" + args.get_message() + "\n" + args.get_stackTrace());

My code deploys successfully with no errors but not able to see... Please help me on this,I am not getting an intellisense menu for the client object model classes and objects.

Is there a step by step process tutorial or suggestions are highly appreciated

Retreving items in a SharePoint list using Client Object Model in javascript and bind that to repeator control

  • executeQueryAsync() should contain success and fail callbacks both. example: executeQueryAsync(GetListItemById_Successor, GetListItemById_Fail);
    – Garima
    Commented Jan 8, 2014 at 10:13

1 Answer 1


instead of:



SPContext.executeQueryAsync(Function.createDelegate(this, this.GetListItemById_Successor), Function.createDelegate(this, this.GetListItemById_Fail));        


  • Why do we need to call Function.createDelegate() ? Commented Jun 29, 2015 at 11:35
  • thats because it needs to pass the values to the function. Function.createDelegate means your creating a function and within the function your delegating varibles to that function. in the example above its calling: " function onQuerySucceeded(sender, args) { " and " function onQueryFailed(sender, args) { " both are functions and both have two paramaters that i delegated to it.
    – Ali Jafer
    Commented Jun 29, 2015 at 14:31
  • Ah thank you. So I can take your first line of code if I do not need to delegate arguments and if I need some I use the createDelegate. But unless of delegating variables it should be the same. Am I right? Commented Jun 30, 2015 at 9:29

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.