2 Replies Latest reply on Sep 5, 2016 12:25 PM by Julien Maulbault

    EPDM api Get File with no local file in the local view

    Julien Maulbault

      Hello,

       

      Context:

      I create a file in the Vault in the computer1, then I checkin it.

      I go to the computer 2 to find my file. It is here but with no local file (not cached)

       

      API c#:

      I run this on the computer 2:

      IEdmFolder5 ParentFolder = null;

      var file = _Vault1.GetFileFromPath(iFilePath, out ParentFolder);

       

      file isNull, because there is no local file.

       

      Is there a way to load a local file only, when at first there is no local version ?

      Am I forced to update the complete folder ?

        • Re: EPDM api Get File with no local file in the local view
          Lee CS Young

          Look for GetFileCopy in the help file or BatchGet.

          • Re: EPDM api Get File with no local file in the local view
            Julien Maulbault

            I found the answer.

             

            This method is able to get a file without local version, Vault.GetFileFromPath is not !

             

            private IEdmFile5 GetFileFromPath2(string iFilePath, out IEdmFolder5 iFolder)

                    {

                        try

                        {

                            var folderPath = System.IO.Path.GetDirectoryName(iFilePath);

                            var folder = _Vault2.GetFolderFromPath(folderPath);

                            if (folder == null)

                                throw new Exception("The folder '{0}' doesn't exist".FormatString(folderPath));

                            var fileName = System.IO.Path.GetFileName(iFilePath);

                            var file = folder.GetFile(fileName);

                            if (file == null)

                                throw new Exception("The file '{0}' doesn't exist".FormatString(fileName));

                            iFolder = folder;

                            return file;

                        }

                        catch

                        {

                            iFolder = null;

                            return null;

                        }

                    }