Copy SharePoint Online List with Data (with list items) to another site

 We have PNP!!!

Using this post, and upgrading it with to the new PNP, this is the results

1. Make variable $listName = "listTitle" (hebrew works :))

$listName = "קריאות לבאטמן"

2. Make variable $templateName = "c:\template\HR-listTemplate" (or another path)

$templateName = "c:\template\BAT-listTemplate"

3. Connect to SiteA

Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/SiteX/SiteA"

4. Get list template

Get-PnPSiteTemplate -Handlers Lists -ListsToExtract $listName -Out ("{0}.xml" -f $templateName)

5. Get items to that same file (peep to the xml file)

Add-PnPDataRowsToSiteTemplate -path ("{0}.xml" -f $templateName) -List $listName -Query '<view></view>'

6. Connect to SiteB

Connect-PnPOnline -Url "https://amymetom1.sharepoint.com/sites/AmyPortal2"

7. Provision the list

Invoke-PnPSiteTemplate -Path ("{0}.xml" -f $templateName) 

8. Go to site content and be proud at yourself

:)

 

Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem