- Install PnP PowerShell:
Install-Module -Name "PnP.PowerShell" - Connect to the OneDrive URL:
Connect-PnPOnline -Url https://company-my.sharepoint.com/personal/jsmith_company_com -Interactive - List the file versions:
Get-PnPFileVersion -Url "Documents/Documents/myfile.txt" - Remove all the file versions (does not remove file itself):
Remove-PnPFileVersion -Url "Documents/Documents/myfile.txt" -All
Using PnP PowerShell, you can also get the size of a folder (in MB):
$Folder = Get-PnPFolder -Url "Documents/Documents" -Includes ListItemAllFields Write-host "Size of the Folder:" $([Math]::Round(($Folder.ListItemAllFields.FieldValues.SMTotalSize.LookupId/1MB),2))
No comments:
Post a Comment