I'm building a Node.js app running on an external server, which needs to retrieve all SharePoint lists and associated items.
Using the code below, I get a number of lists, but a few of them seem to be missing.
var spauth = require('node-sp-auth');
var request = require('request-promise');
var spr = require('sp-request').create({
username: 'xxx',
password: 'xxx'
});
spr.get('https://siteURL/_api/lists/')
.then(function (response) {
var items = response.body.d.results;
for(var i = 0; i < items.length; i++) {
console.log('List Title:', items[i].Title);
}
})
.catch(function(err){
console.log(err);
});
Example:
The lists 'Projects' and 'Tasks' are not part of the result set, but can be accessed through [siteURL]/lists/Projects and [siteURL]/lists/Tasks
I can also see they are present under that exact name on the 'Site contents' page.
When trying to retrieve the lists by using the 'GetByTitle' method or based on the guid, I get following error message (StatusCodeError: 404):
List 'Projects' does not exist at site with URL [siteURL]
Does anyone have an idea what could cause specific lists to be apparently unknown or inaccessible through the REST API?
Thanks!
via user1933091
No comments:
Post a Comment