Forum Discussion
PnP Provisioning Engine template support for publishing pages ?
You can provision Publishing Pages using PnP, see an example below:
<pnp:File src="mypublishingpage.aspx" Folder="{site}/Pages" Overwrite="true">
<pnp:Properties>
<pnp:Property Key="ContentTypeId" Value="{contenttypeid:MyPageContentType}" />
<pnp:Property Key="Title" Value="My Publishing Page" />
<pnp:Property Key="PublishingPageLayout" Value="{sitecollection}/_catalogs/masterpage/MyPageLayout.aspx, My Page Layout" />
</pnp:Properties>
</pnp:File>
In this example a Publishing page with the filename mypublishingpage.aspx is provisioned to the pages library using the specified Content Type and Page Layout.
Are there any specific challenges you face when provisioning Publishing Pages?
Can you point to a sample set of files (template.xml and any others needed) to deploy a publishing page? I am trying to do it using the <pnp:File>, but I get an ArgumentNullException related to the "stream" parameter of the "Microsoft.SharePoint.Client.FileFolderExtensions.UploadFile" using an XML structure very similar to that which you provide (btw - typo in the "src" attribute - should be "Src").
Do I need a local file matching the "Src" attribute for upload. Perhaps with the TemplateRedirect content in it?
<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage, Microsoft.SharePoint.Publishing,Version=15.0.0.0,Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Reference VirtualPath="~TemplatePageUrl" %> <%@ Reference VirtualPath="~masterurl/custom.master" %>