SharePoint 2016/PnP powershell: how to get page content?

Occasional Contributor

We are using SharePoint 2016. I am working alot with PnP powershell. I would like to use the command "Get-PnPProvisioningTemplate" to get the content of the welcomepage which is an publishing page. But in the xml template I dont see the page content. I have read there are some issues when you try this and you use in the connect the parameter -UseLogin. Because we are using SharePoint 2016 in combination with ADFS and MFA (Multi factor authentication) we need to use the parameter -UseLogin.

 

Is there another way to get the welcomepage content in xml?

 

I use at this moment this command:

 

Connect-PnPOnline -Url "https://mycompany.com" -UseWebLogin

Get-PnPProvisioningTemplate -Out "c:\mytemplate.xml"

 

In the xml template I see alot like: propertybag, security, columns, contenttypes, lists. But no Pages section.

2 Replies

Have you tried Get-PnPClientSidePage or Get-PnPWikiPageContent ?

One of them should do the trick, but if not, you can extract the XML of each web part on the page using Get-PnPWebPartXML and manually build the page XML

 

hope this helps

 

I will try it and let you know if it works.