2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Programming and macros
nordstjernen740
Posts: 46
Joined: Thu Apr 15, 2021 5:44 pm
Answers: 2
x 12
x 27

2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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.
image.png
by nordstjernen740 » Thu Nov 03, 2022 9:54 am
o[ 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!
Go to full post
User avatar
JSculley
Posts: 638
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 868

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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?
User avatar
AlexB
Posts: 493
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 27
x 265
x 440

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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.
nordstjernen740
Posts: 46
Joined: Thu Apr 15, 2021 5:44 pm
Answers: 2
x 12
x 27

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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?
nordstjernen740
Posts: 46
Joined: Thu Apr 15, 2021 5:44 pm
Answers: 2
x 12
x 27

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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.
nordstjernen740
Posts: 46
Joined: Thu Apr 15, 2021 5:44 pm
Answers: 2
x 12
x 27

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post 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.
Attachments
BatchUnlockFiles_CSharp.zip
(70.04 KiB) Downloaded 48 times
nordstjernen740
Posts: 46
Joined: Thu Apr 15, 2021 5:44 pm
Answers: 2
x 12
x 27

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post by nordstjernen740 »

o[ 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!
User avatar
AlexB
Posts: 493
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 27
x 265
x 440

Re: 2022 sp4 PDM API Issue with batchUnlocker.AddSelection

Unread post by AlexB »

nordstjernen740 wrote: Thu Nov 03, 2022 9:54 am o[ 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!
Post Reply