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?
- <div ng-app="listApp">
- <div id="App1" ng-controller="controller1">
- <h1>First List Itemsh1>
- <div ng-repeat="item in items">
- <p>{{item.Title}}p>
- div>
- div>
- div>
- var appVar = angular.module('listApp', []);
- appVar.controller("controller1", function($scope){
- GetListItems($scope, "List1");
- });
- function GetListItems($scope, listName){
- $.ajax({
- url: "https://example.com/sites/mysite/_api/web/lists/GetByTitle('"+listName+"')/items",
- method: "GET",
- async: false,
- headers: { "Accept": "application/json;odata=verbose" },
- success: function(data){
- $scope.items = data.d.results;
- },
- error: function(sender,args){
- console.log(args.get_message());
- }
- });
- }
Ramesh PalaniappanPosted Aug 22, 2016, 11:18 AM
SP.ListItemCollectionresource endpointreturns all the field values for a list items with some limitation for User/Lookup fields (for performance reasons):
In your example only
SP.ListItem.Titleproperty is printed, if you want to display all the returned list item values it could be accomplished like this:Some another suggestions:
jQuery.ajax()in Angular apps