PnPTemplate issue

sns 9,236 Reputation points
2022-03-06T16:31:57.467+00:00

I have used command get-pnpsitetemplate for one of the site collection ( site1-source) and template stored in the windows system32 folder as expected.
Now I have used invoke command to apply these saved template to other site collection ( site2-destination) but attached error is popping up. Please help

I have tried to execute pnptracelog but not sure which command we need to use to trace the logs and also where these pnp trace logs gets saved. Please help.

Also please clarify what exactly these get-pnpsitetemplate would do? is it only migrating the content from site 1 to site2 or will it do anything more specific?. Because I have tested this and noticed it is only migrating the SharePoint components such as list, library etc.

To Apply exact front page & look & feel of one particular site collection to other site collection which PNP command need to use? Please provide command. 180386-pnptemaplateissue.png

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,643 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CaseyYang-MSFT 10,436 Reputation points
    2022-03-07T07:38:44.14+00:00

    Hi @sns ,

    To execute pnptracelog you have to run Set-PnPTraceLog -On -Level:Debug before Get/Apply command.

    With Get-PnPSiteTemplate command you could generates a provisioning site template from a web.

    PowerShell commands:

    1.Get-PnPSiteTemplate

    #Set variables  
    $SiteURL = "https://xxx.sharepoint.com/sites/xxx"  
    $SchmaXMLPath = "C:\Temp\SiteSchema.xml"  
    
    #Connect to PnP Online  
    Connect-PnPOnline -Url $siteUrl -Interactive  
    
    #Get Site Schema  
    Get-PnPSiteTemplate -Out ($SchmaXMLPath) -PersistBrandingFiles -PersistPublishingFiles  
    

    2.Invoke-PnPSiteTemplate

    #Set variables  
    $SiteURL = "https://crescent.sharepoint.com/sites/projects/morocco"  
    $SchmaXMLPath = "C:\Temp\SiteSchema.xml"  
    
    #Connect to PnP Online  
    Connect-PnPOnline -Url $SiteURL -Interactive  
    
    #Apply Pnp Provisioning Template  
    Invoke-PnPSiteTemplate -Path $SchmaXMLPath -ClearNavigation  
    

    For Reference: How to Copy a Site in SharePoint Online using PowerShell
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


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.