AnsweredAssumed Answered

IEdmBatchGet Parameter Incorrect for EPDM program

Question asked by Daniel McRae on Apr 20, 2015
Latest reply on Jul 10, 2015 by Danny Bradford



Some time ago, we came up with a task that involved one of our people changing a custom property for a whole bunch of drawings in EPDM to all have the same value, so I wrote a little program in C# that would check out all the files, change the custom property and check them all in again. Just recently I had to make a small change to it because the EPDM workflow changed, but when I recompiled it, it no longer works. The bit I changed has nothing to do with the bit that isn't working.


I get a list of files to change via a drag and drop interface, then iterate over the files to remove the ones that are already checked out. I end up with a List<EdmSelItem> called checkedInFiles. From there, I'm trying this:


EdmSelItem[] selItemArray = checkedInFiles.ToArray();

IEdmBatchGet getter = vault.CreateUtility(EdmUtility.EdmUtil.BatchGet) as IEdmBatchGet;

EdmVault5 tempVault = (EdmVault5)vault; // The vault is already logged in, but some methods need it to be EdmVault5 rather than IEdmVault12

getter.AddSelection(tempVault, selItemArray);


There it crashes with the exception "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))". If I try and add files in individually using AddSelectionEx it works:


foreach (EdmSelItem file in selItemArray)


    getter.AddSelectionEx(tempVault, file.mlDocID, file.mlProjID,

        ((IEdmFile5)tempVault.GetObject(EdmObjectType.EdmObject_File, file.mlDocID)).CurrentVersion);



The annoying bit is that this was working perfectly before, it just isn't now. Exactly the same error appears when I try and check stuff in later in the program.


Any suggestions?