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
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