User Profile
AlyaKoni
Copper Contributor
Joined Feb 17, 2020
User Widgets
Recent Discussions
Re: How Do I get the version of a file using PnP Powershell
Nigel_Price9911 For SharePoint Online I'm using following code: Get-PnPFile -Url $item.ServerRelativeUrl -Path $destinationFolderPath -AsFile -Force # Latest version $ctx= Get-PnPContext $ctx.Load($item.Versions) $ctx.ExecuteQuery() foreach ($version in $item.Versions) { $versionValue = $version.VersionLabel $str = $version.OpenBinaryStream() $ctx.ExecuteQuery() $filename = (Split-Path $item.ServerRelativeUrl -Leaf) + "." + $versionValue $filepath = Join-Path $destinationFolderPath $filename $fs = New-Object IO.FileStream $filepath ,'Append','Write','Read' $str.Value.CopyTo($fs) # Older version $fs.Close() }20KViews1like3Comments
Recent Blog Articles
No content to show