How to Get-PnPSiteScriptFromWeb : File Not Found ?

The PnP team has developed a module called Get-PnPSiteScriptFromWeb that provides the site specifications in JSON format, which may be used to construct a site template from the current team site in SharePoint Online when trying to do so.

The following problem was encountered when attempting to use an admin connection to access the SharePoint site and extract the site script.

SharePoint site

Fix

The issue here is it cannot get the script when not connected to the Site Context. To get the site script from the existing site, it is required to connect to the site first and then get the site script out of it.

Replace the $SiteUrl, ClientId, Tenant, and Thumbprint with respect to your organization setup. On successful completion, you should see something similar to the below screenshot.

ClientId

Note that the -Interactive and User Credentials methods of connecting to the SharePoint online site have been deprecated by the PnP SharePoint PowerShell module. In order to connect to the SharePoint online site using connect-pipeline modules, the certificate must be used. The references section contains more information about setting up an application registration in Entra and configuring the certificate to connect to SharePoint online sites.

You may also like...

Popular Posts