I'm downloading files from a SharePoint site to a local folder. I can connect and download files with no issue, but I go to remove them, I'm getting Error: Cannot compare "PnP.PowerShell.Commands.Model.SharePoint.RecycleResult" because it is not IComparable.
if (Test-Path -Path $DestPath$FileDownload -PathType leaf){
Remove-PnPFile -ServerRelativeUrl $SPRelativeURL$FileDownload -Recycle -ErrorAction Ignore -Connection $connectionReport -Force
}
The $SPRelativeURL$FileDownload is the same concatenated variable used when the file is downloaded. The process is to download the first file, confirm it was downloaded, and then remove the file from the folder on the SharePoint site. Then the process is repeated for the second file. I'm not sure what that error means. Anyone know? Full error:
Error: Cannot compare "PnP.PowerShell.Commands.Model.SharePoint.RecycleResult" because it is not IComparable.
Error: System.Management.Automation
Error: at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)