0 Replies Latest reply on May 1, 2013 3:09 PM by Jim Sculley

    API: IEdmBatchGet vs. IEdmFile.LockFile vs. Manual Check Out

    Jim Sculley

      I have discovered that these three methods provide different behavior for the same input conditions.  If I have a PDF file open in Acrobat Reader, and I try to check it out with code in my EPDM add-in using LockFile, a COMException is thrown with the message "An attempt was made to access a file that is exclusively open by another application".  If I use IEdmBatchGet with the EdmGetCmdFlags.Egcf_Lock option, the call succeeds and the file is checked out, despite being open in another application.  When I use GetFileList with its various arguments I get the following vaules for the Count property:

       

      Egflf_GetFailed --  0

      Egflf_GetLocked -- 1

      Egflf_GetRetrieved -- 0

      Egflf_GetUnprocessed -- 0

       

      If I try the check out manually from an Explorer window, nothing happens.  There is no error message, but the file is not checked out.  There are no permissions issues, because everything works when the file is not open in Acrobat Reader.

       

      I don't understand why the behavior varies.  This is causing me problems because I have code for generating new versions of PDFs, and if a user has the PDF open, SolidWorks cannot generate the new one.  It simply hangs because I am using IEdmBatchGet and I would rather not switch to LockFile.

       

      Jim S.