Forum Discussion
Home.aspx content and webparts when extracting PnP site provisioning schema?
- Jan 14, 2017
A little update from the PnP Core Team: I just changed the behaviour of the PageContents handler (which is the handler that extracts the homepage). It was checking for the presence of Credentials on the ClientContext and if not present it would not execute the extraction of artifacts. That check is still valid for On-Premises, due to the fact that we have to call a webservice to work around CSOM limitations, but is not needed anymore for SPO as that version of CSOM allows us to export all webparts. I now made that check conditional based upon the version of the NuGet package you're running, and it will be available in version 2.12.1702.0 (the February 2017 release).
Hi Pasi Bergman,
The Get-SPOProvisioingTemplate cmdlet collects the welcome page including web parts.
I'm assuming that you are extracting the template as a .pnp file. If you extract it as an .xml it will be easier to check if your page/web parts are included. Of course it is better to use the .pnp format for normal use but for debug purposes it can help to use the .xml format.
- Pasi BergmanNov 01, 2016Copper Contributor
Thank you for taking the time to reply. I really appreciate it.
I am expecting the Get-SPOProvisioingTemplate to collect also the Home.aspx but the XML file I'm getting does not include Pages element and threfore no page content nor webpart either.
This is what I do...
1) I create a new SharePoint Online Team Site (English) with my account as the site collection administrator
2) I then edit the welcome page /SitePages/Home.aspx. I remove the default content except for the Documents webpart. I also add some text to the wikifield content area and then I save the page.
3) Using the latest PnP SharePoint Online PowerShell I then
Connect-SPOnline -Url https://mytenant.sharepoint.com/sites/mytemplatesite -UseWebLogin Get-SPOProvisioningTemplate -Out .\mytemplatesite1.xml
6) I also try
Get-SPOProvisioningTemplate -Out .\mytemplatesite2.xml -PersistPublishingFiles
and
Get-SPOProvisioningTemplate -Out .\mytemplatesite3.xml -IncludeNativePublishingFiles
None of these prorduce xml file with the Pages element and content of the Home.aspx (i.e. WebPart and WikiField contents).
I won't attach the schema xml's. Hopefully everyone takes my word for it that the Pages there is no Pages nor Page element in those. I'm attaching the TRACE LOGs of the three Get-SPOProvisioningTemplate executions numbered as 1, 2 and 3.