Sharepoint: List ‘Site Pages’ does not exist at site

Sharepoint: List ‘Site Pages’ does not exist at site

I recently got this error from Sharepoint Online, when trying to fetch a site’s list using https://pnp.github.io/pnpjs/:

List 'Site Pages' does not exist at site with URL https://acme.sharepoint.com/sites/site1

The code resulting in the error was this:

import { Web } from "@pnp/sp/webs";
 
const siteUrl = "https://acme.sharepoint.com/sites/site1"
let web: any = Web(siteUrl);
let pages: any = await web.lists.getByTitle("Site Pages").items.select("Title").getAll();

After spending (too much) time troubleshooting this, it turned out to be a language settings mismatch: The site I was connect to was set up with Norwegian as the default language, which means that the list isn’t called “Site Pages” but rather “Områdesider”. So apparently, when fetching lists from sites you must account for site’s language settings. I found this to be pretty non-intuitive, as language settings to me typically is something that affects the end user, not something that affects how on programatically connects to a service.

Anyways, just though I’d share this just in case others come across the same issue.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: