Forum Discussion
Nigel_Price9911
Feb 12, 2018Iron Contributor
How Do I get the version of a file using PnP Powershell
Hi
I am trying to get the version of a file in a document library using PnP Powershell.
Connect-PnPOnline -Url <url>
$ListItems = Get-PnPListItem -List <MyDocLibrary>
for each ($item...
Nigel_Price9911
Feb 14, 2018Iron Contributor
Works great (as long as you put the t on the end of Get-PnPContex !)
What about if I only want the latest version ?
Regards
Nigel
Manidurai Mohanamariappan
Feb 16, 2018Iron Contributor
You can try this modified script
Connect-PnPOnline -Url <url> $ListItems = Get-PnPListItem -List <MyDocLibrary> $ctx= Get-PnPContext foreach ($item in $ListItems) { $file = $item.file $ctx.load($file) $ctx.ExecuteQuery() Write-Host $file.Name,$file.UIVersionLabel }
- Poonam_AmbeJun 26, 2020Copper ContributorWorked for me