0

I have created an Angular JS application which would output a list of data in a Share Point list. I am trying to make a rest API call to my Share Point List to get the data, however I am unable to do it as I get an error 403 Forbidden.

Below is my controller which tries to fetch the data.

app.controller('RetrieveRecords', function ($q, $http, $scope) {
var url = "https://testapp.sharepoint.com/sites/testmyapplication/_api/web/lists/getByTitl 
e('TestAppList')/items?$select=Status,Time";

$http(
{
 method: "GET",
 url: url,
 headers: { "accept": "application/json;odata=verbose" }
}
).success(function (data, status, headers, config) {
$scope.details = data.d.results;

}).error(function (data, status, headers, config) {
});
});

My Angular JS application is not a Share Point page, my application is basically hosted as a Azure Static Website. I checked some online tutorials, however I couldn't find a solution to the problem I am facing.

Thank you.

  • There is no error in code. Maybe this is because you are are doing this cross domain. Try adding this code in SharePoint page and check it is working or not. – Ganesh Sanap Feb 18 at 2:53
  • @GaneshSanap If I navigate to the URL via browser, it displays the items. But if I go through the code I get the 403 error. – john Feb 18 at 3:53
  • It will definitely work in browser. But you are using it in Azure website. That's why you are getting this error. – Ganesh Sanap Feb 18 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.