I am trying to develop an add-in to catch and stop file deletions within PDM Professional so can be handled in accordance with our policies.
I have been successful in catching the predelete with:
"poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreDelete)"
and in the OnCmd section stopping the operation with:
"poCmd.mbCancel = True"
But I still get a warning box or error.
"Error deleting File. Cause: The operation was not permitted by one of the installed add-ins."
I have tried including in a Try statement ending with catches:
"
Try
poCmd.mbCancel = True
Catch ex As Runtime.InteropServices.COMException
Select Case ex.ErrorCode
Case EPDM.Interop.EPDMResultCode.EdmResultErrorCodes_e.E_EDM_OPERATION_REFUSED_BY_PLUGIN
MessageBox.Show("Test")
Case Else
MessageBox.Show("HRESULT = 0x" +
ex.ErrorCode.ToString("X") + vbCrLf +
ex.Message)
End Select
Catch ex As Exception
MessageBox.Show(ex.Message)"
but this don't seem to catch.
Any help would be appreciated
SolidworksApi macros