Are Tables supported in PnP Site Templates?

Rene Wagner 161 Reputation points
2021-02-01T21:30:53.937+00:00

Hello,

I have created a SP 2016 site that I want to use as a template for PnP Provisioning. On the home page of my site I edited the page and created a table that I am using to create a 2-column page layout. In each column I added a couple of web parts and configured them. When I view the page in the site it looks correct and my web parts appear as expected in either the left or right-side column.

I then generated a site template using the command:

Get-PnPProvisioningTemplate -Out "PnP-Provisioning-File.xml" -Schema V201508

NOTE: For whatever reason I had to use the older version of the schema (based on a post I ran across) because without that schema specified the template generation would fail.

Once I had the template file, I then ran the command:

Apply-PnPProvisioningTemplate -Path "C:\temp\PnP-Provisioning-File.xml" -ClearNavigation -IgnoreDuplicateDataRowErrors

This command executed successfully and did not show any errors. However, when I accessed the site where the template was applied, the landing page showed all the web parts, but no table. All the web parts were shown, but in a single, vertical layout, one above the others. There was no table on the page with the two columns.

Is it not possible to include tables in a template to allow for very simple page layouts?

Thanks

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,623 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,573 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,041 Reputation points
    2021-02-02T09:18:37.467+00:00

    Hi @Rene Wagner ,

    Per my test, I could reproduce your issue on my SharePoint 2016. It seesm to be a bug when generating template for the wiki page layout.

    I check the template.xml file, the layout shows incorrectly in the file. It should be TwoColumns instead of OneColumn.

    62919-image.png

    So I change the Layout to TwoColumns, and change the webparts column from 1 to 2. This would work.
    62933-image.png

    62897-image.png

    For this issue, I would suggest you submit new issue in the github: https://github.com/pnp/powershell/issues


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rene Wagner 161 Reputation points
    2021-02-02T16:52:33.113+00:00

    Interesting ... that makes sense. When you ran your test, did you explicitly specify the schema like I did?

    I did some more testing and it appears that the issue may have been caused by the schema. One of the reasons I (thought) I had to use the schema is due to an error related to "types" that I had when I originally tried to generate the template file. Adding the schema resolved the error ... but this is an old version of the schema. Long story short, it turns out that my original error was not due to the missing schema, but because I was running PnP on one of my SP Servers, and so it seems there was a module/DLL version conflict between PnP and SharePoint. I finally ended up running the PnP commands from a non-SP server/host and from there I was able to run without specifying a schema version (which means it should default to the latest).

    When I ran it this way, I was able to generate an XML template file that did properly extract/apply the template to a new site. Also, I found that when I generated a PNP file instead of a XML, that generated the proper layout. So it may be that the issue was caused by a bug in the (old?) schema version.

    When I To add to this, what I also found is that if I generate a PNP file instead of an XML file using the command:

    Get-PnPProvisioningTemplate -Out "c:\temp\PnP-Provisioning-File.pnp"

    then it pulls both columns and properly applies them and locates the web parts as expected when I apply the template.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.