I have a plugin that uses the Laserfiche API to transfer files to a Laserfiche repository. Files are failing to transfer due to an exception being thrown upon calling LFSO90Lib.ILFFieldData.Update() which states "One or more required fields were omitted."
I have tried using several different templates. None of the templates have any fields that are marked as required, so I have no idea why I am getting that error message.
Here is a snippet of the code in the area where this issue is occurring:
ILFDocument boNewDoc = new LFDocument(); boNewDoc.Create(bsAttachmentFileName, (LFFolder)boParentFolder, (LFVolume)aoVolume, true); IDocumentImporter boDocImporter = new DocumentImporter(); boDocImporter.Document = boNewDoc; boDocImporter.ImportElectronicFile(bsAttachmentFilePath); ILFFieldData poFieldData = (ILFFieldData)boNewDoc.FieldData; poFieldData.Template = (LFTemplate)aoTemplate; poFieldData.LockObject(Lock_Type.LOCK_TYPE_WRITE); poFieldData.Template = (LFTemplate)aoTemplate; // Loops through and assigns values to fields within the template like so: poFieldData.Field[bsMetadataField] = bsMetadataValue; // After looping through all the fields being added, calls Update() // This is where the error occurs: poFieldData.Update();
Update: This same issue was also occurring in the Laserfiche desktop client. We found that there was a default template on the repository which did have required fields. Upon changing that default template, the issue no longer occurs in the desktop client.
However, it does still occur in our integration using the Laserfiche API. Files are transferred successfully to the repository, but upon calling Update(), we continue to receive the same error message.