Problem with Export-PnPPage #1835
Unanswered
SteveWedge
asked this question in
Q&A
Replies: 1 comment
-
I have the same problem and identical code. Surprisingly it works with a page from different site. I only assume that it might be somehow related to activated publishing feature. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've got version 1.10.0 of Pnp.Powershell installed and am getting the following error when I run a script which I am attempting to get details of a customised modern SharePoint Teams Site Home Page to use as a template for the creation of other Sites' Home Pages.
Export-PnPPage : Object reference not set to an instance of an object
At C:\Users\SteveWedge\OneDrive - QSP GLOBAL (UK) LTD\Powershell\SharePoint\CopyITTeamSiteHomePage.ps1:11 char:1
The script I am running is not complex and at one point today did complete execution and produce some output, although the file which was created did not actually include the full definition of the page, webparts, etc. (see attached) so wasn't very helpful.
Since that 1 successful execution of the Export-PnPPage cmdlet, every subsequent attempt has failed. I'd rather not have to build out the other 10 Site Home pages manually, so am hoping someone can shed some light on what's wrong with this, or suggest an alternative approach.
$SourceSiteURL = "https://companyname.sharepoint.com/teams/XYZ-GLBL-IT-Infrastructure-Operations"
$DestinationSiteURL = "https://companyname.sharepoint.com/teams/XYZ-GLBL-IT-Infrastructure-EMEA"
$PageName = "Home.aspx"
#Connect to Source Site
Connect-PnPOnline -Url $SourceSiteURL -Interactive
#Export the Source page
$TempFile = [System.IO.Path]::GetTempFileName()
Export-PnPPage -Force -Identity $PageName -Out $TempFile -PersistBrandingFiles
#Import the page to the destination site
tmp2AA9.txt
Connect-PnPOnline -Url $DestinationSiteURL -Interactive
Invoke-PnPSiteTemplate -Path $TempFile
Beta Was this translation helpful? Give feedback.
All reactions