Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

As mentioned by Amy, you need to switch the context to a site collection context from the tenant context. The sharepoint admin site doesn't have the site pages library, so its throwing that error. You can make use of PnP's clone method to "take over" the security context of existing client context instance as below: Modify your code as below: var tenant ...


In the samples in the articles below, when creating a new client-side page, finally save the page to the site pages library. And there is no sitepages library in the site, it will throw the error. So we ...

Only top voted, non community-wiki answers of a minimum length are eligible