Issue while Getting latest Version

Hi I got issue with getting latest version of PDM files.
I have not complete the codes but even half way I got errors.
Could you please any one help on this?

I did replace “VaultName” with my vault name.

image

Thanks.

public static void GetLatestVersionOfList(ArrayList recordList)
        {
            try
            {
                EdmVault5 pdmVault = new EdmVault5();
                pdmVault.LoginAuto("VaultName", 0);

                IEdmFile5 aFile;
                IEdmFolder5 ppoRetParentFolder;
                IEdmFolder5 aFolder;
                IEdmPos5 aPos;

                IEdmBatchGet pdmBatchGetUtil;
                pdmBatchGetUtil = pdmVault.CreateUtility(EdmUtility.EdmUtil_BatchGet);

                EdmSelItem[] ppoSelection = null;
                Array.Resize(ref ppoSelection, recordList.Count);

                int i =0;
                foreach (string item in recordList)
                {
                    aFile = pdmVault.GetFileFromPath(item, out ppoRetParentFolder);
                    aPos = aFile.GetFirstFolderPosition();
                    aFolder = aFile.GetNextFolder(aPos);
                    ppoSelection[i] = new EdmSelItem();
                    ppoSelection[i].mlDocID = aFile.ID;
                    ppoSelection[i].mlProjID = aFolder.ID;
                    i = i + 1;
                }

                pdmBatchGetUtil.AddSelection((EdmVault5)pdmVault, ref ppoSelection);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

Did you place a break point and determine which line/command is producing this error?

1 Like

Which is causing this?

I’m shooting in the dark:

  • Check off Prefer 32 bits in the project properties
  • Make sure you are referencing the pdm interops dll with Embed Interop Types = False
1 Like

Thanks for your reply.
This is the exact line I’m getting an error while putting the breakpoint.
pdmBatchGetUtil.AddSelection((EdmVault5)pdmVault, ref ppoSelection);

  • Check off Prefer 32 bits in the project properties
  • Make sure you are referencing the pdm interops dll with Embed Interop Types = False

Both are set at the first place. I’m getting this error with this same configuration you mentioned above.
Sorry. Do I need to mention some additional details? Please let me know if you need any.

Thanks

Yes. Stack trace please.

At that particular line, stack trace is empty while getting error.

Is there any other detail I can share?

Thanks

@prabaharanpichaiyan I plugged in your exact function into a new project and it runs fine on my test vault. I’m leaning toward some setting in your project properties causing issues.

2 Likes

Check your arguments.

Also a strack trace cannot be empty unless you’re in the release configuration…

1 Like

Guys. Somehow the issue fixed by recreating project again. I’m not sure what is the difference between new and old one. But works well now.

Thanks all for the support.

I am very happy for you that your issue is solved. The question however does not bring any added value to the future users of the forum. I may flag this question for deletion.

Thanks!

Sure. Thanks a lot for your time

1 Like