We're storing our engineering change notice information in SW PDM as an XML file, and the drawings referenced by the file are the ones that the notice is supposed to mention. As part of this, when the references are changed on the ECN file, we want it updates the internal XML to reflect the references. This way there's nothing in the file itself that needs to get the drawing or do any work on it. All the other metadata is linked by PDM variables to structures in the file.
I have a PDM add in that runs on the hook for files on check in (EdmCmd_PreUnlock). This looks at the being checked in and quickly quits if the files don't match specific criteria - right file type for the ECN file and right location. If it is an ECN file, then it does more processing. If the XML in the ECN file has IDs matching the ID of referenced files, then it's done, but when the IDs don't match it does more work - it alters the XML to remove the information about files that aren't there and add it for files newly added. This way the contents of the XML file only updates when the referenced files are added or removed, so that it doesn't pull the latest version of a referenced file's data through, which would be bad.
All of the XML processing works well, thanks to the fantastic .NET libraries. At the end of the PreUnlock processing of the XML file, it saves the file and lets PDM continue with the check in. And here is where the problem arises. If the internal stuff in the file didn't change (the metadata linked to inside the XML, for instance), then PDM thinks there's no change to the file and checks it in without updating the file itself.
Is there any way to force PDM to check in the file contents from the add-in, even if there's no change before the add-in runs?