Workgroup PDM API: Pushing Refresh to the Add-In Interface

I've written a macro for Workgroup PDM which my company uses.

The macro is fairly simple, and it works fine.

The context is this: if you have a document open, you run the macro and it will find the PDM pointer to that document and grant you ownership if nobody has ownership.

Here's the issue: When I take ownership via the macro, I can't get my local application instance of Solidworks to realize that now I have write access to the active document. In the add-in that shows my fault, I have access no problem. I've tried refreshing the vault connection in the macro, and refreshing vault connection via the add-in button, I've reloaded and verified the model, but aside from purging the document from memory and then re-opening the file I don't know how to get the application itself to notice that now I have write access; I'm hoping there is a way to do this without the purge. I see a CloseandReopen method for drawings, and a ForceReleaseLocks which looks like it is overkill and maybe dangerous to use in this scenario; I want to basically push SW to re-check with PDM for write-access to the active document.

I've also noticed strange behavior from PDMWConnection interface. I Dim the container variable for the PDMWConnection instance without the "New" modifier and it seems to give me access to the vault without having to call a Login command. I'm assuming it's tapping into the connection established by my running PDMWorks Add-in. But A) sometimes it has "unknown network connection error" so it doesn't seem to reliably "latch" to the add-in's connection to PDM and B) I run Refresh calls after all changes made to the vault, but my add-in interface never refreshes without me hitting the button. So sometimes I can make changes to the vault with my Login command lines commented out (sometimes I can't), so I'm thinking it's hooking on the existing connection from the add-in, but my Refresh calls on that connection don't refresh my add-in tree view; I can't see the changes to ownership of a document without hitting the button on the add-in.

Any thoughts or comments on these issues?

Many thanks in advance!

SolidworksApi macros