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

Question

Question

Export previous versions

SDK
asked on May 5, 2016 Show version history

Can I export previous versions of electronic document (Word) with SDK?

 

Thanks.

 

0 0

Answer

SELECTED ANSWER
replied on May 5, 2016

Please use GetVersionHistory to obtain a collection of VersionHistory objects for a document, select the version that is desired, and pass the VersionHistory object as the IDocumentContents argument to the export function.

Sample code:

DocumentInfo documentInfo = Document.GetDocumentInfo(repoDocumentPath, session);
if (documentInfo.IsUnderVersionControl)
{
	VersionHistory versionHistory = documentInfo.GetVersionHistory();
	foreach (DocumentVersion documentVersion in versionHistory)
	{
		string comment = documentVersion.Comment;
		if (comment.ToLower().Contains("hello"))
		{
			var docExp = new DocumentExporter();
			docExp.ExportElecDoc(documentVersion, outputFilename);
			break; // foreach
		}
	}
}

 

1 0
replied on May 6, 2016

The code snippet works fine!

Thank you!

0 0

Replies

replied on May 5, 2016

I am not sure but since it could be done in client, it could be done with sdk. I think you should look into

GetAlternateEdoc method of IDocumentContents.

0 0
replied on May 6, 2016

Alternate electronic documents are not used by anything in Laserfiche at this time.

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

Sign in to reply to this post.