The title might be worded funky, but I'm not sure how else to summarize. Let me explain what I'm trying to do. I have a SDK script that loops through files inside of a regular Windows folder. Then, in Laserfiche, it creates a document for each file and finally imports the file into the document. If anything goes sideways during this process, all files are corrupt and the process has to be restarted. Is there a way to commit each file/document before the session is properly closed? Below is a small snippet. I removed the try catch and such ...
DocumentImporter import = new DocumentImporter(); string lfFolderPath = @"somepath"; FolderInfo fi = Folder.GetFolderInfo(lfFolderPath, session); for (int i = 0; i < fileCollection.Count; i++) { string docName = fileCollection[i].Name; string path = fileCollection[i].Path; DocumentInfo docInfo = new DocumentInfo(session); docInfo.Create(fi, docName, volumeName, EntryNameOption.Overwrite); docInfo.Save(); import.Document = docInfo; import.OcrImages = false; import.ImportImages(path); }
It works quite nicely, unless something goes awry, such as a file is deleted from the Win folder mid-process. I'd just like to keep the LF documents that were already created in a previous loop without corruption. Any ideas? Thanks for your time :)