pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
416 stars 642 forks source link

ClientSidePage is ignored on SharePoint 2019 using the PnP Provisioning engine #2179

Open sebastienlevert opened 5 years ago

sebastienlevert commented 5 years ago

Category

Environment

If SharePoint on-premises, what's exact CU version: 16.0.10341.20000

Expected or Desired Behavior

I would expect to have the ability to generate and to create ClientSidePages using the PnP Provisioning Template

Observed Behavior

ClientSidePages are skipped in both cases. If we generate a PnP Provisioning Template from a site (generate its home page), our PnP Template is empty. If we provide a ClientSidePage to this PnP Provisioning Template, the ClientSidePage is skipped and nothing happens.

We see this compilation directive that basically prevents the Handler to support On-Premises... I understand there is a lot more on Online, but is there a reason why the Provisioning Engine does not support this? https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectClientSidePages.cs#L17

Steps to Reproduce

# Using the following script skips the generation of the ClientSidePage
Get-PnPProvisioningTemplate -Out "Template.xml" -Handlers PageContents

We get the following template :

<?xml version="1.0"?>

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2018/05/ProvisioningSchema">
  <pnp:Preferences />
  <pnp:Templates ID="CONTAINER-TEMPLATE-CLIENTSIDEPAGES">
    <pnp:ProvisioningTemplate ID="TEMPLATE-CLIENTSIDEPAGES" Version="1" Scope="RootSite">
    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>
# Using the following script skips the creation of the ClientSidePage in the target site
Apply-PnPProvisioningTemplate -Path "Template.xml"

And we're using the following PnP Template

<?xml version="1.0"?>

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2018/05/ProvisioningSchema">
  <pnp:Preferences />
  <pnp:Templates ID="CONTAINER-TEMPLATE-CLIENTSIDEPAGES">
    <pnp:ProvisioningTemplate ID="TEMPLATE-CLIENTSIDEPAGES" Version="1" Scope="RootSite">
    <pnp:ClientSidePages>
      <!-- Auto-Generated Client Side Pages -->
      <pnp:ClientSidePage Title="Blank" PageName="Blank.aspx" PromoteAsNewsArticle="false" Overwrite="true" EnableComments="false">
      </pnp:ClientSidePage>
    </pnp:ClientSidePages>
    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>
heinrich-ulbricht commented 5 years ago

Ah ClientSidePages. Currently in SharePoint Online ony the home page is being exported. I created a ticket to change this behavior: #2124 Provisioning though works for all pages manually added to the template.

As for on-prem I assume that the capabilities of the ClientSidePages might be different (more layout options in SPO, more available web parts). So the provisioning engine would have to handle this. Apart from that the #if !ONPREMISES seems to be from 2017. So maybe this is indeed outdated and could be changed to include SharePoint 2019 - @jansenbe ?

benjacernuda commented 5 years ago

Any updates about this issue?

Same behavior in my environment (SP 2019 v16.0.10337.12109).

If I try to apply a PnP template using with a ClientSidePage, the step is ignored, the page isn't created.

If I export a template using Get-PnPProvisioningTemplate using Handler.All the Welcome Page is not included in the generated template, and if I use Handler.PageContents the generated template is empty (only including the pnp.ProvisiningTemplate tag in the xml file)

I'm using SharePointPnPPowerShell2019 powershell library v3.13.1909.0

I tried it with the .Net CSOM library and, as it's expected, the result was the same.

I guess while this doesn't work the option to create pages in the site provisioning in SP 2019 is programatically. I don't know if anybody has other ideas/suggestions about this..

Thanks in advance!

heinrich-ulbricht commented 5 years ago

Exporting and importing all pages in SharePoint Online now works (as I described here), which is great.

But looking here this functionality is still not available on-premises.

andikrueger commented 4 years ago

This issue should be resolved with PR: https://github.com/SharePoint/PnP-Sites-Core/pull/2412

The code preventing the ObjectClientSidePages from being available for SP 2019 was changed to:

https://github.com/SharePoint/PnP-Sites-Core/blob/4519e6d7f5ac1dd5131fca840e70ffa10351f749/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectClientSidePages.cs#L19

Can anybody confirm, if it works now?