Pnp-sites-core: Get-PnPProvisioningTemplate - not extracting all the pages with added parameter -IncludeAllClientSidePages

Created on 17 Dec 2019  路  8Comments  路  Source: pnp/PnP-Sites-Core

Category
[x] Bug
[ ] Enhancement

Environment
[x] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

SharePointPnPPowerShellOnline 5.1.11763.771

Expected or Desired Behavior
Get-PnPProvisioningTemplate -Out "C:\Development\Templates\RootSiteTemplate.xml" -IncludeAllClientSidePages

Should extract all the Pages in Site Pages

Observed Behavior
Client Side Pages in Site Pages are not getting extracted in the xml.
When trying to view them with Get-PnPListItem -List "SitePages" command, it does return the pages on site as expected.
Able to download them with Get-PnPFile -Url "/SitePages/Home.aspx" -Path "C:\Development\Templates\" -AsFile

Steps to Reproduce
Note : The site was created as a Modern Team Site.

Default tenant had provided Communication Site as Root Site.
Used Invoke-SPOSiteSwap to swap the root site collection into Modern Team Site.

Get-PnPProvisioningTemplate -Out "C:\Development\Templates\RootSiteTemplate.xml" -IncludeAllClientSidePages

Needs

Most helpful comment

@wobba @deanbot @Chitra-Dharaiya @Voyta and anyone else that encounters a problem running this command. I have now successfully run the command including -IncludeAllClientSidePages. The issue was caused by having multiple installs (different versions of the same modules). You can check what you have installed by running the following script:

Get-Module Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending

To fix this issue I removed all my modules. This can either be done via the control panel > programs - look for SharePoint or PNP shell (this is if you have installed at via an msi or exe) or via the following PowerShell command:

Get-InstalledModule -Name "SharePointPnPPowerShellOnline" -RequiredVersion 3.6.1902.2 | Uninstall-Module
Get-InstalledModule -Name "Microsoft.Online.SharePoint.PowerShell" -RequiredVersion 16.0.20414.12000 | Uninstall-Module

Ensure you select the correct version. I then installed both cmdlet's:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force -AllowClobber
Install-Module -Name SharePointPnPPowerShellOnline -Force -AllowClobber

I then ran the command and it worked first time!

All 8 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

I'm troubleshooting this as well. See related issue https://github.com/pnp/PnP-PowerShell/issues/2620

It appears it works as desired if you add also the -PersistBrandingFiles switch argument. To get just pages you could run: Get-PnPProvisioningTemplate -IncludeAllClientSidePages -PersistBrandingFiles -Out $ArtifactPath -Handlers PageContents

@deanbot @Chitra-Dharaiya @Voyta @wobba @okms - any update on this? When I try to run the script without -IncludeAllClientSidePages it extracts the XML for the homepage. When I include -IncludeAllClientSidePages it fails with the following message: Get-PnPProvisioningTemplate : A parameter cannot be found that matches parameter name 'IncludeAllClientSidePages'.
I would like to export all the sites pages. ;o(

@sawyerr44 have you tried to update the PnP Powershell cmdlets to a newer version?

@wobba I'm now running SharePointPnPPowerShellOnline 3.25.2009.0 (upgraded from 3.24.2008.1). I still receive the same error message.

Get-PnPProvisioningTemplate : A parameter cannot be found that matches parameter name 'IncludeAllClientSidePages'.
At line:3 char:242

  • ... geContents -ExtensibilityHandlers $handler -IncludeAllClientSidePages

    • CategoryInfo : InvalidArgument: (:) [Get-PnPProvisioningTemplate], ParameterBindingException

    • FullyQualifiedErrorId : NamedParameterNotFound,SharePointPnP.PowerShell.Commands.Provisioning.Site.GetProvisioningTemplate

If I run the script without -IncludeAllClientSidePages it does export the homepage.

Is there anything else I can check?

@wobba @deanbot @Chitra-Dharaiya @Voyta and anyone else that encounters a problem running this command. I have now successfully run the command including -IncludeAllClientSidePages. The issue was caused by having multiple installs (different versions of the same modules). You can check what you have installed by running the following script:

Get-Module Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending

To fix this issue I removed all my modules. This can either be done via the control panel > programs - look for SharePoint or PNP shell (this is if you have installed at via an msi or exe) or via the following PowerShell command:

Get-InstalledModule -Name "SharePointPnPPowerShellOnline" -RequiredVersion 3.6.1902.2 | Uninstall-Module
Get-InstalledModule -Name "Microsoft.Online.SharePoint.PowerShell" -RequiredVersion 16.0.20414.12000 | Uninstall-Module

Ensure you select the correct version. I then installed both cmdlet's:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force -AllowClobber
Install-Module -Name SharePointPnPPowerShellOnline -Force -AllowClobber

I then ran the command and it worked first time!

@Chitra-Dharaiya did you resolve your issue?

Was this page helpful?
0 / 5 - 0 ratings