0

SharePoint Online (Microsoft 365) PnP.PowerShell - 1.10.0

I am using the following PowerShell commands to save a modern site as a template:

    $url = "https://<private>.sharepoint.com/sites/StudiesBillingCenter"
    
    Connect-PnPOnline -Url $url -Interactive
    
    Get-PnPSiteTemplate -Out "D:\Office365_Sites_Templates_Export_Import\StudiesBillingCenter\StudiesBillingCenter-site-template.xml"

Disconnect-PnPOnline

And the following code to import it to another tenant SharePoint Online site:

$url = "https://<private-1>.sharepoint.com/sites/Studies-Billing"

Connect-PnPOnline -Url $url -Interactive
 
Invoke-PnPSiteTemplate -Verbose -Debug -Path "D:\Office365_Sites_Templates_Export_Import\StudiesBillingCenter\StudiesBillingCenter-site-template.xml"

Disconnect-PnPOnline

And I am getting a lot of error messages during the template import, like this one:

Column 'Report_x0020_Description' does not exist. It may have been deleted by another user.

+ CategoryInfo          : WriteError: (:) [Invoke-PnPSiteTemplate], ServerException
+ FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate

As a result Lists were actually created but views were not imported at all.

But when I was using handlers (for lists) and imported them one by one there were no error messages and all views were created:

Get-PnPSiteTemplate -Handlers Lists -ListsToExtract "GL-2022 - List" "D:\Office365_Sites_Templates_Export_Import\StudiesBillingCenter\StudiesBillingCenter-site-template-List-2022.xml"

Am I doing something wrong?


I have deleted the whole <pnp:ListInstance ... Reports%20List ... </pnp:ListInstance> in xml file and the script ran with no error messages. "Content and Structure Reports" list caused my problems (see my comments).

1 Answer 1

0

Check to see that the columns "Report_x0020_Description" is in the site columns list of the destination site. It may be that this is column was defined in your content type hub and not published to the destination site.

4
  • My destination site is a Team site and it has not been customized in any way before the PnP provisioning. So, of course, it didn't have any elements that were imported from the source site. When I imported a list-only template there were no errors besides "Cannot find principle" which is an expected error message. And this is not the only thing that PnP complained of (like, ContentTypeBinding ContentTypeID="0x01002CF74A4DAE39480396EEA7A4BA2BE5FB", which is Reusable HTML, which is a built-in Content Type)
    – lk7777
    Apr 13, 2022 at 13:53
  • Can you verify that the field was exported in the .xml file (a simple search should suffice). If should be in a FieldRef Tag. Apr 13, 2022 at 14:57
  • Thank you for your help. Yes, it is there but it looks like it is listed in the view of non-existent List. Url="{site}/Reports List/AllItems.aspx" Probably this list has been deleted. But how can I find that view on the source site to delete it. I can't comment it out in the template xml file.
    – lk7777
    Apr 13, 2022 at 16:05
  • Thank you for your help. Yes, it is there but it looks like it is listed in the view of non-existent List. Url="{site}/Reports List/AllItems.aspx" Probably this list has been deleted. But how can I find that view on the source site to delete it. I can't comment it out in the template xml file. I guess, I found it: Reports%20List "Content and Structure Reports". SharePoint Server Publishing Infrastructure was probably activated initially but now it is not. So this is the problem now?
    – lk7777
    Apr 13, 2022 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.