Page 1 of 1
2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Wed Nov 02, 2022 4:40 pm
by nordstjernen740
Hi, shot in the dark, but is anyone else having trouble with the 2022 pdm api batch check-in interface?
I had to revert to testing with the solidworks provided example in order to rule out myself adding a problem with my own code. I get an error with the example code. EXAMPLE CODE: (
https://help.solidworks.com/2022/Englis ... esigner.cs)
The error I get is on with line 156 in the example code. "batchUnlocker.AddSelection((EdmVault5)vault1, ref ppoSelection);"
Any one else having this problem and are there any known workarounds?
Cross posted on the swamp.
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 7:52 am
by JSculley
I just ran the example code with no problems. Can you ZIP up your Visual Studio solution with just the SW example code and upload it?
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 8:05 am
by AlexB
Just a shot in the dark, but did you double check that the properties "Prefer 32-bit" in your visual studio project is unchecked? This can cause the API to freak out unexpectedly.
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 9:21 am
by nordstjernen740
JSculley wrote: ↑Thu Nov 03, 2022 7:52 am
I just ran the example code with no problems. Can you ZIP up your Visual Studio solution with just the SW example code and upload it?
Are you running solidworks 2022?
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 9:34 am
by nordstjernen740
AlexB wrote: ↑Thu Nov 03, 2022 8:05 am
Just a shot in the dark, but did you double check that the properties "Prefer 32-bit" in your visual studio project is unchecked? This can cause the API to freak out unexpectedly.
I did have this checked, but when I unchecked it, I got a problem with the openfiledialog. I commented that stuff out and just hard coded a file id and folder id to my pposelection single element array.
Same issue.
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 9:41 am
by nordstjernen740
Attached is the example code with filedialog related code commented out and file id and folder id hard coded just to focus on the one issue. You would have to replace the hard coded values with ids that match folders and documents in your vault to run this. I had working code prior to upgrading to 2022 sp4, so I suspect something is broken or has changed on the upgrade, so the version of the api you are running I believe is important.
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 9:54 am
by nordstjernen740
I think I figured it out. when I upgraded to 2022 and reselected epdm.interop.epdm I forgot to flip "embed interop types" from true to false again. Flipped it back and it works!
Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection
Posted: Thu Nov 03, 2022 10:11 am
by AlexB
nordstjernen740 wrote: ↑Thu Nov 03, 2022 9:54 am
I think I figured it out. when I upgraded to 2022 and reselected epdm.interop.epdm I forgot to flip "embed interop types" from true to false again. Flipped it back and it works!
I think that gets us all from time to time which is why this and the 32-bit selection are the first things typically suggested to check before digging further into the code. Glad you got it sorted!