I am trying to upload a file to laserfiche in laserfiche format. I have a piece of code that upload files in original file format to laserfiche.
1) How do i convert that document to laserfiche format/ Laserfiche pages ?
2) Am i doing this the right way ?
This is what i am doing.
1) Create a destination folder in laserfiche
2) Create a laserfiche document at that destination folder location
3) Import the local file as Edoc to the laserfiche document
# region creates a file with specified folder name and filename
//Prevent memory leak with the using statement
using (DocumentInfo doc = new DocumentInfo(mySess))
{
//Check if the destination folder exists
EntryInfo docentryinfo = Entry.TryGetEntryInfo(laserfichedestinationfolder, mySess);
if (docentryinfo == null)
{
//Create a document in the destination folder
doc.Create(laserfichedestinationfile, "DEFAULT", EntryNameOption.AutoRename);
//It is advised to lock the document folder / document before making any changes .. saw this in the docs
docentryinfo.Lock(LockType.Exclusive);
DocumentImporter DI = new DocumentImporter();
DI.Document = doc;
//Import the local file into the laserfiche document ...gives the mime type and path of the file as arguments
DI.ImportEdoc(System.Web.MimeMapping.GetMimeMapping(Path.GetFileName(localfilepath)), localfilepath);
docentryinfo.Unlock();
}
}
#endregion