I have created a Powershell script to copy List items from one Sharepoint Library Column to another within the same Document Library. I am having trouble with getting the contents of list item. This is the Powershell Script...

-Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

-Get the SPWeb object and save it to a variable

$web = Get-PnPWeb /sites/InterSignWorkgroup

-Variables that are used for list editing

$list = Get-PnPList "FWO History"

-Get all items in this list and save them to a variable

$items = Get-PnPListItem -List $list -Fields "Title".FieldValues

-Go through all items

foreach($item in $items)
    $email = (Get-PnPListItem -List $list -Fields "Title").FieldValues
    Set-PnPListItem -List $list -Identity $item -Values @{"Customer_x0020_Email" = $email}        

The return value that I am getting... "System.Collections.Generic.Dictionary`2[System.String,System.Object]"

Is there a way to get the actual value of the field "Title" using Get-PnPListItem?

3 Answers 3


Sample script for your reference, file Title is empty by default, so make sure Title has value.

#region Variables 
$Username = "[email protected]" 
$Password = "password" 
$siteURL = "https://tenant.sharepoint.com/sites/lee" 

#endregion Variables

#region Credentials 
[SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force 
[System.Management.Automation.PSCredential]$PSCredentials = New-Object System.Management.Automation.PSCredential($Username, $SecurePass) 
#endregion Credentials

Connect-PnPOnline -Url $siteURL -Credentials $PSCredentials

$list = "MyDoc";
$items = (Get-PnPListItem -List $list -Fields "Title","GUID")

foreach($item in $items) {
$email = $item["Title"]
#Set-PnPListItem -List $list -Identity $item -Values @{"Customer_x0020_Email" = $email}

To get the field Title field you need this script:

$list = Get-PnPList -Identity "FWO History"
$listItems = Get-PnPListItem -List $list -Fields "Title"

foreach($item in $listItems)
    Set-PnPListItem -List $list -Identity $item['ID'] -Values @{"Customer_x0020_Email" = $item.FieldValues.Title}

Corrected Script and now it is working...

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

$web = Get-PnPWeb /sites/InterSignWorkgroup
$list = Get-PnPList "FWO History"
$items = Get-PnPListItem -List $list

foreach($item in $items) {    
    $lookup = $item.FieldValues["FWO_x0023_"]
    Set-PnPListItem -List $list -Identity $item -Values @{"Title" = $lookup}        

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.