posted on April 13, 2020

I couldn't figure out why an import into Laserfiche from Windows was skipping certain files and I've figured out why in case anyone else has a similar issue. For each file, I took the path and passed it into the ImportImages function under DocumentImporter. This worked fine except for certain files, and I realized that it's because the ImportImages was taking the filename and automatically reformatting it if it contains a % sign.

 

Example: A file called 0v%50 had its title reformatted to 0vP since 50 is the hexadecimal code for the letter P. Of course, there is no 0vP file so it did not find it.

 

I was able to work around this by putting the file into a stream and feeding the method the stream instead.

Instead of:

di.ImportImages(path);

I used:

using (Stream imageStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
       di.ImportImages(imageStream);
}

I hope this helps anyone else who might have a similar issue.

2 0