[BUG] Remove-PnPContentType - Try Catch Doesn't Work Properly #1255
Unanswered
robertcaretta
asked this question in
Q&A
Replies: 1 comment
-
@robertcaretta - This is unlikely a PnP issue. The |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reporting an Issue or Missing Feature
When using Remove-PnPContentType and Remove-PnPContentTypeFromList the errors do not cause the catch action to fire properly. So I am unable to log the results properly. If there is a work-around please let me know.
Expected behavior
When the cmdlets error, the catch action should trigger so I can log the action properly and/or take a different action.
Actual behavior
When the action fails it doesn't register as an error that can be caught by try catch.
I am marking the site content type as editable properly before removal attempts as well.
Steps to reproduce behavior
try { Remove-PnPContentType -Identity $_.Name -Force -Verbose $msg = "SUCCESS | Site CT Removed | $SiteURL | CT: $($_.Name)" Write-Host $msg Write-Log -LogFile $logFile -LogMessage $msg } catch { $msg = "ERROR | Site CT Not Removed | $SiteURL | CT: $($_.Name)" Write-Host $msg Write-Log -LogFile $logFile -LogMessage $msg } finally { Clear-Variable msg }
What is the version of the Cmdlet module you are running?
1.8
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions