我正在尝试使用SharePoint 2013中的REST API从外部列表中获取列表项。下面是外部URL: http:// mrutyunjaya / _layouts / 15 / start.aspx#/ Lists / Tool%20Max%20Time / Read%20List.aspx 我正在尝试使用REST API从此列表中检索数据。下面是到目前为止编写的代码:
I am trying get list items from an external list using REST API in SharePoint 2013. Below is the external URL: 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:
var app = angular.module('EatonScanningApp');
app.factory("EatonScanningFactory", ['$http', function($http) { var EatonScanningFactoryObj = {};
EatonScanningFactoryObj.GetToolMaxTimeList = function () { return $http({ method: 'GET', url: "psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items", headers: { "Accept": "application/json;odata=verbose" } }); }
}]); 我正在尝试访问上述休息服务下面的代码,但我无法获得存储在$ scope.list中的外部列表长度的正确输出,如下所示:
}]); 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:
$scope.list = EatonScanningFactory.GetToolMaxTimeList();
console.log($($scope.list.length));
请帮助 我尝试过:
Please help What I have tried:
var app = angular.module('EatonScanningApp');
app.factory("EatonScanningFactory", ['$http', function($http) { var EatonScanningFactoryObj = {};
EatonScanningFactoryObj.GetToolMaxTimeList = function () { return $http({ method: 'GET', url: "psmi-dev3/_api/lists/getbytitle('Tool%20Max%20Time')/items", headers: { "Accept": "application/json;odata=verbose" } }); }
}]);
}]);
推荐答案http', function (
http){ var EatonScanningFactoryObj = {}; http) { var EatonScanningFactoryObj = {};
EatonScanningFactoryObj.GetToolMaxTimeList = function () { return
http({ method:' GET', url: http:// psmi-dev3 / _api / lists / getbytitle('Tool%20Max%20Time')/ items, header :{ 接受: application / json; odata = verbose} }); } http({ method: 'GET', url: "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
中
更多推荐
使用sharepoint 2013中的REST API从外部列表中获取数据
发布评论