0

I am using PnP PowerShell to save a SharePoint TeamSite (STO#3) as a provisioning template. This works fine. However, the homepage of the site is not being saved.
My PowerShell Script:

# Variables definition
$tenant = "apptivsolutionscom";
$sourceSite = "/PnPTestHome";
$templateFile = "C:\PnPDropDirectory\PnPTemplate.xml";

# Office 365 Login 
$webUrl = "https://{0}.sharepoint.com{1}/" -f $tenant, $sourceSite;
Write-Output $("Connecting to {0}" -f $webUrl);
Connect-PnPOnline -Url $webUrl -Credentials WCMStoredCredentials;
#use the line bellow to connect if you are using multi factor authentication  
#Connect-PnPOnline -Url $webUrl -UseWebLogin;

# Save Template
Write-Output "Saving PnP template";
Get-PnPProvisioningTemplate -Out $templateFile -PersistBrandingFiles -PersistPublishingFiles;
0

Is this a classic site? Where is the home page located? Site Pages, Site Assets? Try adding these to the parameters.

 -IncludeNativePublishingFiles -Handlers All

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.