May 07 2019 07:57 AM
Hi,
I am trying to retrieve Site pages items by using pnp getByTitle, as shown below.
let web = new Web (this.context.pageContext.web.absoluteUrl);
web.lists.getByTitle('Site Pages').items.get().then(console.log);
and I have established context (spfxContext: this.context and context: this.context) in the .ts File.
On the console log I keep getting the same error every time, which is, it couldn’t find the list 'Site Pages'.
I know the code works properly because it gets all the items when I tried it on in one of my other tenants. So, I’m guessing the problem lies somewhere in my tenant Site Pages settings.
Can someone help me with this issue?
May 07 2019 08:06 AM
@amha97 Have you read this this documentation? https://pnp.github.io/pnpjs/sp/docs/items/
May 07 2019 11:13 AM
@Beau Cameron Yes I have read it and as I understand it this
sp.web.lists.getByTitle("My List").items.get().then((items: any[]) => { console.log(items); });
Should work for “Site Pages” also and as I mentioned, when i tried the same thing in my other SharePoint account it did work just fine.