AnsweredAssumed Answered

Puzzling Behavior with IEdmBatchGet and IEdmFile::IsLocked

Question asked by Jim Sculley on Feb 21, 2016
Latest reply on Feb 23, 2016 by Jim Sculley

I'm using the following code in an EPDM add-in:

 

IEdmBatchGet batchGet = (IEdmBatchGet)vault.CreateUtility(EdmUtility.EdmUtil_BatchGet);
Array fileData = Array.CreateInstance(typeof(EdmSelItem), cncFileModelFilePairs.Count);
int index = 0;
foreach (Tuple<IEdmFile11, IEdmFile11> t in cncFileModelFilePairs)
{
    EdmSelItem nextItem = new EdmSelItem();
    nextItem.mlDocID = t.Item1.ID;
    nextItem.mlProjID = Utilities.getFileFolder(t.Item1).ID;
    fileData.SetValue(nextItem, index++);
}
batchGet.AddSelection((EdmVault5)vault, ref fileData);
EdmGetCmdFlags getOptions = EdmGetCmdFlags.Egcf_Lock /*| EdmGetCmdFlags.Egcf_RefreshFileListing*/;
batchGet.CreateTree(parentWindowHandle, (int)getOptions);
bool test = batchGet.ShowDlg(parentWindowHandle);
batchGet.GetFiles(parentWindowHandle);

 

Basically I have a list of pairs of files and I'm adding one file from each pair to the batch get which then checks the files out.  This all appears to be successful, and the files are checked out when viewed in explorer.  However, if I use IEdmFile::IsLocked in my add-in, it returns false indicating that the file is not checked out.  If I write a simple little macro that calls IsLocked, and run it from SW, it returns true.

Outcomes