C# Add-in for SolidWorks PDM: Registering Only Files Matching a Filename Pattern (.NET Framework 4.7.2)

Hi everyone, please don’t throw stones — I’m just getting started with the API and everything around it.

I’m trying to write an extension for SolidWorks PDM that validates filenames against a specific pattern during check-in. If a file doesn’t match the pattern, I want to prevent it from being checked in. If it does match, it should proceed with the check-in.

I’ve already written an add-in that performs the validation, and it works. However, I’m now trying to improve it by splitting the files into two arrays: one with valid files and one with invalid ones. What I want is for the valid files to be checked in, while the invalid ones should be excluded from the check-in process altogether.

Currently, if at least one file in the batch doesn’t match the pattern, none of the files get checked in. I’d like to avoid that and allow the valid files to proceed.

Could anyone point me to the right method or approach to achieve this?

Thanks a lot in advance!

I’ve looked into this, and unfortunately, poCmd can’t selectively cancel only the affected documents through a hook.

In this case, it would be more effective to build a full SOLIDWORKS add-in instead.