You are viewing limited content. For full access, please sign in.

Question

Question

The object is not identified, and cannot be locked or read from.

asked on April 21, 2015

HI All,

 

I have written a small app that adds a document (tiff image) with some field data but I keep getting an error when I try to import an image file attached to the visual studio solution.

The error is "The object is not identified, and cannot be locked or read from."

and the code is

 
DocID = Document.Create(WorkflowDocPath & DocName, VolumeName, EntryNameOption.AutoRename, mySession)

 Dim ei As EntryInfo = Entry.GetEntryInfo(DocID, mySession)
 ei.SetTemplate(LFTemplateName)
 ei.Save()

 'Import Image
dim myresourcePath as string = System.IO.Path.GetFullPath(Application.StartupPath)

Dim MyDocument As New DocumentInfo(mySession)
Dim di As New DocumentImporter
di.Document = MyDocument
di.OcrImages = False
di.ImportImages(myresourcePath & "Image1.tif") 'ERROR Here


 'Add metadata
Dim FVC As FieldValueCollection = ei.GetFieldValues
 FVC.Add("Template", TemplateName)
FVC.Add("Current Name", CurrentName)
FVC.Add("New Name", NewName)
 FVC.Add("Current Code", CurrentCode)
FVC.Add("New Code", NewCode)

 ei.Lock(LockType.Exclusive)
 ei.SetFieldValues(FVC)
 ei.Save()
 ei.Unlock()

The file is in the folder windows sees it as a tiff file and I can open it.

Have I missed something?

Andrew

0 0

Replies

replied on April 21, 2015 Show version history

The DocumentInfo you are passing to DocumentImporter doesn't correspond to an existing document, pass the EntryInfo ei to di.Document instead:

Dim ei as DocumentInfo = Document.GetDocumentInfo(DocID, mySession)

...

di.Document = ei

Also, lock the document immediately after calling GetDocumentInfo, then unlock it at the end (or wrap everything in a using block to do this automatically)

 

1 0
replied on April 21, 2015
 
 

Hi Andrew,

 

I believe you have to create an entry in Laserfiche and then import your image into it.  The error you are receiving is relating to ImportImages not being able to find a Laserfiche entry to read/lock.

 

See the Importing Images help file:

Dim document as New DocumentInfo(mySess) 
document.Create("\Folder1\MyNewDocument", "Volume1", EntryNameOption.AutoRename)
Dim DI As New DocumentImporter
DI.Document = document
DI.OcrImages = True
DI.ImportImages("C:\Temp\Image.tif")

Cheers,

Carl

 
You are not allowed to follow up in this post.

Sign in to reply to this post.