Copy Sharepoint list items to another list with Powershell and PnP

You can easily copy Sharepoint list items to another list with Powershell and PnP.

First connect to the source Sharepoint site. You can use one of mine connector scripts for it here at Technet. Or connect to Sharepoint with:

#Create credential object
$cred = Get-Credential

#Import the Skype for Business Online PS session
Connect-PnPOnline -url $siteUrl -Credentials $cred

Get the list items

Now we need to retrieve the list items that we want to copy:

# Get source list items
$listItems = Get-PnPListItem -List 'ListName' -Fields "Project","Title","Description","Address"

Copy the items to the destination list

Now it’s time to copy the data. First connect to the destination site (if the list is at another Sharepoint site)

#Connect to destination site using the connector script
ConnectTo-Sharepoint -siteUrl ''

foreach($item in $listItems) {
        #Create object
	$itemVal = @{
		'ProjectName' = $item['ProjectName']
		'Title' = $item['Title']
		'Desciption' = $item['Desciption']
		'Address' = $item['Address']
	Add-PnPListItem -List 'newlist' -Values $itemVal -ContentType "Item"

A few important notes (that took me a few hours to figure out)

In Sharepoint, list columns can have a different internal name then you see when open Sharepoint. To get all the available list names, run the following cmdlet

# Get all the lists from the connected Sharepoint site

# Show fields from the selected list
Get-pnpfield -list 'listname'

If one of the columns in the list contains a hyperlink, than you can get the content from it with:

$url = $item['HyperlinkFieldName'].url
$desc = $item['HyperlinkFieldName'].description

$itemVal = @{
  'NewLinkField' = "$url, $desc"
  'Title' = $item['Title']


Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

5 thoughts on “Copy Sharepoint list items to another list with Powershell and PnP”

  1. Great article Rudy. Quick question, do you know how to transfer V3Comment history with PnP? I can transfer the latest comment from a list with your script, but I haven’t been able to find a way to do the previous comments.

  2. Hi thank you for the post. Unfortunately, when i use the Get-PnPListItem -List ‘ListName’ -Fields “MyField”, the value of the filed is empty. And when i use this (Get-PnPListItem -List Tasks -Fields “MyField”).FieldValues, i get all the fileds and no way to filter for just “MyField”. Hopefully soemone will read this and have an idea for me :).

Leave a Comment