Andrew Andrew - 1 year ago 213
reST (reStructuredText) Question

Angularjs Sharepoint Rest API to showing all columns

I have created a very basic controller to pull data from a SharePoint list, but it only pulls the base Title and created column. It doesn't pull any columns I have created, which are the ones I require. Is there a setting in SP itself to state it is available for the API?

I have used the code off this site:

As shown here:

var appVar = angular.module('listApp', []);

appVar.controller("controller1", function($scope){
GetListItems($scope, "List1");

function GetListItems($scope, listName){
url: "'"+listName+"')/items",
method: "GET",
async: false,
headers: { "Accept": "application/json;odata=verbose" },
success: function(data){
$scope.items = data.d.results;
error: function(sender,args){

<div ng-app="listApp">
<div id="App1" ng-controller="controller1">
<h1>First List Items</h1>
<div ng-repeat="item in items">

Answer Source

SP.ListItemCollection resource endpoint

/_api/web/lists/getByTitle('<list title>')/items

returns all the field values for a list items with some limitation for User/Lookup fields (for performance reasons):

In case of User/Lookup fields only lookup ids will be retrieved by default.

In your example only SP.ListItem.Title property is printed, if you want to display all the returned list item values it could be accomplished like this:

<div ng-repeat="item in items">    
     <p ng-repeat="(key, value) in item">
          {{ value }} 

Some another suggestions:


<div ng-app="spApp" ng-controller="TasksController" >
        <tr ng-repeat="t in tasks">
            <td ng-repeat="(key, value) in t" ng-if="!value.hasOwnProperty('__deferred') && !value.hasOwnProperty('__metadata')">
                   {{ value }}



.controller('TasksController', function($scope,$http) {
    $scope.tasks = [];

    $scope.getListItems = function(listTitle) {
        return $http({
               method : 'GET',
               url : _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/items", 
               headers: { 'Accept':'application/json;odata=verbose' }

           .success(function(data, status) {
               $scope.tasks = data.d.results;
           .error(function(data, status) {
               console.log("An error occured");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download