Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check-in failed: file at xxx does not exist. Parameter name: filePath

1 REPLY 1
Reply
Message 1 of 2
wesbird
551 Views, 1 Reply

Check-in failed: file at xxx does not exist. Parameter name: filePath

Hi, 

 

  I move the AddOrUpdateFile from Doug's Thunderdome example. Now I like to checkin a pdf from a folder which is not working folder.

  here is the error message:

 

Check-in failed: file at xxxx does not exist.
Parameter name: filePath

 

Here is the code:

 

        public ACW.File AddOrUpdateFile(string localPath, 
            string fileName, ACW.Folder vaultFolder, string comment = "")
        {

            Console.WriteLine("AddOrUpdateFile---" + System.IO.File.Exists(Path.Combine(localPath, fileName)).ToString()); // this return true
 
            string vaultPath = vaultFolder.FullName + "/" + fileName;

            ACW.File[] result = _docSvc.FindLatestFilesByPaths(
                vaultPath.ToSingleArray());

            ACW.File retVal = null;
            if (result == null || result.Length == 0 || result[0].Id < 0)
            {
                VDFE.Folder vdfFolder = new VDFE.Folder(
                    m_cache.Conn, vaultFolder);

                // using a stream so that we can set a different file name
                using (FileStream stream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
                {
                    VDFE.FileIteration newFile = m_cache.Conn.FileManager.AddFile(
                        vdfFolder, fileName, comment,
                        System.IO.File.GetLastWriteTime(localPath), null, null,
                        FileClassification.None, false, stream); // <-<- here is the error popup 

                    retVal = newFile;
                }
            }
            else
            {
                VDFE.FileIteration vdfFile = new VDFE.FileIteration(m_cache.Conn, result[0]);

                AcquireFilesSettings settings = new AcquireFilesSettings(m_cache.Conn);
                settings.AddEntityToAcquire(vdfFile);
                settings.DefaultAcquisitionOption = AcquireFilesSettings.AcquisitionOption.Checkout;
                AcquireFilesResults results = m_cache.Conn.FileManager.AcquireFiles(settings);

                if (results.FileResults.First().Exception != null)
                    throw results.FileResults.First().Exception;

                vdfFile = results.FileResults.First().File;
                VDF.Currency.FilePathAbsolute fpa = localPath.ToVDFPath();
                vdfFile = m_cache.Conn.FileManager.CheckinFile(vdfFile, comment, false,
                    null, null, false, null, FileClassification.None, false, fpa);

                retVal = vdfFile;
            }

            return retVal;
        }

 

  I checked and checked again, file is in localpath. What could be the mistake? 

 

 

 

Thank you very much

Wes

 

Windows 10 64 bit, AutoCAD (ACA, Map) 2023
1 REPLY 1
Message 2 of 2
wayne.brill
in reply to: wesbird

Hello Wes,
 
The subject of this case says "Check-in failed, but in the code there is a comment that error is occurring on AddFile. I am not recreating an error using AddFile(). 

 

>> >>

using (FileStream stream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
                {
                    VDFE.FileIteration newFile = m_conn.FileManager.AddFile(
                        vdfFolder, fileName, comment,
                        System.IO.File.GetLastWriteTime(localPath), null, null,
                        ACW.FileClassification.None, false, stream); // <-<- here is the error popup 

                    retVal = newFile;
                }
<< <<  

 

Could it be the error is happening on this line?

>> >>
vdfFile = m_conn.FileManager.CheckinFile(vdfFile, comment, false,
null, null, false, null, ACW.FileClassification.None, false, fpa);
<< <<

 

I am able to recreate an error like this if fpa is a path where the file that is being checked in does not exist.

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report