SOLVED

List items don't copy when I use PnP Provisioning Engine

Brass Contributor

Hi!
I've a PowerShell script to get template from TestSite2 and invoke this template on TestSite3. 
I use config.json to get only list "testlist" template from TestSite2.

{
  "$schema":"https://aka.ms/sppnp-extract-configuration-schema",
  "persistAssetFiles": true,
  "handlers": [
    "Lists"
  ],
  "lists": {
    "lists": [
      {
        "title": "testlist",
        "includeItems": true,
        "query": {
          "includeAttachments": true
        }
      }
    ]
  }
}

Get-PnPSiteTemplate

#Set Variables
$SiteURL = "https://xxxxx.sharepoint.com/sites/TestSite2"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

Get-PnPSiteTemplate -Configuration "config.json" -Out "template.xml"

Invoke-PnpSiteTemplate

#Set Variables
$SiteURL = "https://xxxxx.sharepoint.com/sites/TestSite3"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

Invoke-PnPSiteTemplate -Path "template.xml"

 
My testlist on TestSite2 have a couple of items, but after invoking template on TestSite3, there are no any items, although I installed "includeItems": true.
Screenshot_595.png
Screenshot_596.png

Could you tell me please, why the items didn't copied?

6 Replies

@Pavel2235 

 

When you get the PnP site template in template.xml file, can you open it and see if it contains DataRow elements?

Example: 

 

<pnp:DataRows KeyColumn="Title" UpdateBehavior="Overwrite">
   <pnp:DataRow>
   </pnp:DataRow>
</pnp:DataRows>

 

DocumentationConfiguring the PnP Provisioning Engine  


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap 
Yes, I see DataRows like this

<pnp:DataRows UpdateBehavior="Overwrite">
    <pnp:DataRow />
    <pnp:DataRow />
</pnp:DataRows>

 

@Pavel2235 oh ok. In that case the list items should have been created in new SharePoint list.

 

Do you get any error/warning while invoking site template?


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap 
There was not any error/warning while invoking and after execution.
I tried to do the same on another List.
Screenshot_600.png
I created a new List "SimpleList" and followed the same steps.
Now it seems that the items have been transferred, but with empty values in the fields.
There were no any error/warning while invoking and after execution either.

By the way, I use Team Site. Maybe this can only be done on Communication Site?

best response confirmed by Pavel2235 (Brass Contributor)
Solution

Hi @Pavel2235 ,

I recently had issues like that.
It seems like this: If you export list elements using the config file, then ALL properties of all fields are exported as datavalues... in order to import these items I had to remove the datavalues for "ContentType" and other internal columns. Then  an import worked.

Btw: If you export a site template like this

 

Get-PnPSiteTemplate list.xml -Handlers Lists -ListsToExtract "MyList"
Add-PnPDataRowsToSiteTemplate -Path .\list.xml -List "MyList"

 

then you don't get datavalue elements for internal columns (But that does not work well for files and attachmetns)

Best Regards,
Sven

@SvenSieverding Thank you very much for your response!

1 best response

Accepted Solutions
best response confirmed by Pavel2235 (Brass Contributor)
Solution

Hi @Pavel2235 ,

I recently had issues like that.
It seems like this: If you export list elements using the config file, then ALL properties of all fields are exported as datavalues... in order to import these items I had to remove the datavalues for "ContentType" and other internal columns. Then  an import worked.

Btw: If you export a site template like this

 

Get-PnPSiteTemplate list.xml -Handlers Lists -ListsToExtract "MyList"
Add-PnPDataRowsToSiteTemplate -Path .\list.xml -List "MyList"

 

then you don't get datavalue elements for internal columns (But that does not work well for files and attachmetns)

Best Regards,
Sven

View solution in original post