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

Question

Question

Getting Issue while executing Document.Create() method.

SDK
asked on August 5, 2014 Show version history

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();

 

0 0

Replies

replied on August 5, 2014

The first error happens because you have the parameters in the wrong order. The document name needs to be before the volume name.

0 0
replied on August 5, 2014

The order of parameters is correct, which i mention previous post.PFB screenshoot for you reference.

 

 

Previously this method was working fine.Since yesterday i am getting isuues.

 

docInfo.Create(rsFolder, Path.GetFileNameWithoutExtension(documentPath), EntryNameOption.AutoRename);

which gives and error: LaserficheRepositoryException: Operation or command invalid for the requested type of object. (9000)

0 0
replied on August 6, 2014

I tried using :


1.docInfo.Create(rsFolder,"DEFAULT", Path.GetFileNameWithoutExtension(documentPath), EntryNameOption.AutoRename);


which gives an error: Laserfiche.RepositoryAccess.ObjectNotFoundException: Volume not found. (9006)

 

Above is the code that Miruna is saying is in the wrong order.  You have the Volume name as the 2nd parameter and the document name as the 3rd.

 

As far as the 9000 error goes, are you sure that the folder is present?  Are you sure the Volume is present?  Are you sure the user has permissions to create the document in the folder as well as in the volume?

1 1
replied on August 6, 2014

We have all permissions to create the documents,every thing is present in LF folder as well as volume .Previously it was working fine,since few days we are getting the issue.

0 0
replied on August 15, 2014

Hi Srinivas, 

 

If your question has been answered, please let us know by clicking the "This answered my question" button on the response.

 

If you still need assistance with this matter, just update this thread. Thanks!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.