I m having Issue while executing Document.Create() method. There are two ways to use it, but none works. Can anyone spot what I am doing wrong
I tried using :
1.docInfo.Create(rsFolder,"DEFAULT", Path.GetFileNameWithoutExtension(documentPath), EntryNameOption.AutoRename);
which gives an error: Laserfiche.RepositoryAccess.ObjectNotFoundException: Volume not found. (9006)
2. docInfo.Create(rsFolder, Path.GetFileNameWithoutExtension(documentPath), "DEFAULT", EntryNameOption.AutoRename);
which gives and error: LaserficheRepositoryException: Operation or command invalid for the requested type of object. (9000)
Both error occurs on executing Document.Create()
Here is the Code:
DocumentInfo docInfo = new DocumentInfo(session);
FolderInfo rootFolder = Laserfiche.RepositoryAccess.Folder.GetRootFolder(session);
FolderInfo rsFolder = Laserfiche.RepositoryAccess.Folder.GetFolderInfo(destinationLocation, session);
docInfo.Create(rsFolder,Path.GetFileNameWithoutExtension(documentPath), "DEFAULT", EntryNameOption.AutoRename);
if (!string.IsNullOrEmpty(templateName) && metadataList != null)
{
docInfo.SetTemplate(templateName);
FieldValueCollection fieldValueCollection = docInfo.GetFieldValues();
foreach (Metadata metadata in metadataList)
{
fieldValueCollection[metadata.FieldInfo.Name] = metadata.FieldValue;
}
docInfo.SetFieldValues(fieldValueCollection);
docInfo.Save();
}
DocumentImporter documentImporter = new DocumentImporter();
documentImporter.Document = docInfo;
documentImporter.ImportEdoc(GetMimeType(documentPath), documentPath);
// dispose the document
docInfo.Dispose();