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
1

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 ...


1

In the samples in the articles below, when creating a new client-side page, finally save the page to the site pages library. https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-pages And there is no sitepages library in the site https://tenant-admin.sharepoint.com, it will throw the error. So we ...


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