
Use following code to retrieve the "Modified By" property for items:
$ListItem['Editor'].Email
Simple test for your reference:
#Set Variables
$SiteURL= "https://tenant.sharepoint.com/sites/Team1"
$ListName="lib76"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get All Files from the document library - In batches of 500
$ListItems = Get-PnPListItem -List $ListName -PageSize 500 | Where {$_["FileLeafRef"] -like "*.*"}
#Loop through all documents
$DocumentsData=@()
ForEach($Item in $ListItems)
{
#Collect Documents Data
$DocumentsData += New-Object PSObject -Property @{
FileName = $Item.FieldValues['FileLeafRef']
FileURL = $Item.FieldValues['FileRef']
ModifiedBy = $Item.FieldValues['Editor'].Email
}
}
$DocumentsData
Result:
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.