An invalid pointer was supplied to the method during UnLockFile

Hi everyone,

I am working on a stand alone c# application that draws components and I want it to take those components and check them into PDM.  I have moved a folder of files into the PDM folders using this code:

 

     foreach (FileInfo file in files)
       {
           string temppath = System.IO.Path.Combine(finalCompleteFolderPath, file.Name);
           file.CopyTo(temppath, false);
       }   

 

Then later I iterate through the files and try to "unlock" (check-in) the files

 IEdmFolder5 ppoRetParentFolder;
   foreach (string file in Files)
   {
           IEdmFile5 aFile = vault.GetFileFromPath(file, out ppoRetParentFolder);
           aFile.UnlockFile(0, "Initial Checkin");
   }

 

I then get the error on the highlighted line about an invalid pointer.  

I have also tried the Batch process for this with the same result.

Any ideas?