Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying get list items from an external list using REST API in SharePoint 2013. Below is the external URL:

http://mrutyunjaya/_layouts/15/start.aspx#/Lists/Tool%20Max%20Time/Read%20List.aspx

I am trying to retrieve data from this list using REST API. Below is the code written so far:

JavaScript
var app = angular.module('EatonScanningApp');

JavaScript
app.factory("EatonScanningFactory", ['$http', function($http) {
    
	var EatonScanningFactoryObj = {};

JavaScript
EatonScanningFactoryObj.GetToolMaxTimeList = function () {
	    return $http({

	        method: 'GET',

	        url: "http://psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items",

	        headers: { "Accept": "application/json;odata=verbose" }

	    });
	}

}]);

I am trying to access the above rest service in the below code but I am unable to get proper output for the length of the external list which is stored into $scope.list as shown below:
JavaScript
$scope.list = EatonScanningFactory.GetToolMaxTimeList();

JavaScript
console.log($($scope.list.length));


Please help

What I have tried:

JavaScript
var app = angular.module('EatonScanningApp');

JavaScript
app.factory("EatonScanningFactory", ['$http', function($http) {
    
	var EatonScanningFactoryObj = {};

JavaScript
EatonScanningFactoryObj.GetToolMaxTimeList = function () {
	    return $http({

	        method: 'GET',

	        url: "http://psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items",

	        headers: { "Accept": "application/json;odata=verbose" }

	    });
	}

}]);
Posted
Comments
vTagMan 4-May-18 5:46am    
Hi! I have similar question.
Are you find answer?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900