SP.List.getItemById Method (sp.js)

Returns the list item with the specified list item identifier.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013



  • id
    Type: Number

    Specifies the list item identifier.

Return value

Type: SP.ListItem


The following example creates an input button on an application page that gets a list item with a specified identifier.

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

   //Get the list item from the Announcements list whose Id is 4. Note that this is the ID of the item in the list, not a reference to its position in the collection.
   var itemId = 4;   
   var targetListItem;

   function runCode() {
     var clientContext = new SP.ClientContext(); 
     var targetList = clientContext.get_web().get_lists().getByTitle('Announcements');
     targetListItem = targetList.getItemById(itemId);
     clientContext.load(targetListItem, 'Title');
     clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

   function onQuerySucceeded() {
       alert('Request succeeded. \n\nRetrieved Item is: ' + targetListItem.get_item('Title'));

   function onQueryFailed(sender, args) {
     alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());


    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />


REST resource endpoint

See List resource for more information.

Endpoint URI structure


HTTP requests

This resource supports the following HTTP commands:

  • POST

POST syntax

POST http://<sitecollection>/<site>/_api/web/lists(listid)/getItemById(id)

Resource parameters

  • id