You can easily get all that information in one call. Site Pages is a document library, similar as a list, all items can be requested with the metadata, author is one of the columns.
E.g.
const list = sp.web.lists.getByTitle('Site Pages');
list.items
.select('*,Author/Title,OData__AuthorByline/Title')
.expand('OData__AuthorByline,Author')
.get()
.then(console.log);
Good day, @s-KaiNet . I have been using sp-request to scrape pages within a site collections on SP2013 for a couple years now. I now need to update my node code to work with SPO, app-only permissions. I'm able to authenticate to SPO without issue however, the same technique to grab the HTML of a SP page no longer works.
With SP2013, I could simply pass the full URL and the response would return the HTML. When I try the same with SPO I get an authentication error. Here's the current code:
/*jshint esversion: 6 */
const sprequest = require('sp-request');
let spr = sprequest.create({
siteUrl: 'https://tenant.org/sites/dev',
clientId: '1beab0a4-a10d-4a6b-xxxx-b4c247faa95f',
clientSecret: 'SZvu9Gmbxxxx9fHGeZ+KC9QBxxxx1ApHAlLeNAermug='
});
const url = encodeURI('https://tenant.org/sites/dev');
function peek(url) {
url = url.toLowerCase();
return new Promise(function () {
spr(url)
.then(function (response) {
console.log(response.body);
})
.catch(function (err) {
console.log('Something went wrong.... ' + err);
});
});
}
peek(url);
npm run build
then npm run publish
with environment variable for authentication (https://github.com/koltyakov/node-sp-auth-config#environment-variables). Please leave an issue with the request to add Azure DevOps sample in the repository I’ll add a generic sample, but it’s really just binding env vars for auth (making sure prod mode is on) and the ordinary frontend project pipeline actions specifics.
Hi @koltyakov ,
I am having some issues on the establishing connection
Below is the code I am using
# Creating private file from multiline variable from matrix
# Encoding secrets in private file
- script: |
touch ./config/private.json && cat <<EOF > ./config/private.json
$(private.json)
EOF
SPAUTH_ENV=production gulp config
displayName: 'Establishing connection'
The error is showing:
<< was unexpected at this time.
I am not sure if it is due to my private.json?
Thank you