You are here

You are here

Retrieving Document History

History is captured on every SpringCM document and includes information such as previews, metadata updates, and document versioning.  Document history can be retrieved via the DocumentHistoryGetById method.

History is always read only.  Common use cases might be to look for changes in metadata or find a previous version of a document.

Vertical Tabs

c#
string documentId = "<Source document Id retrieved by other method calls>";
SCMDocumentHistory[] documentHistory = springCMService.DocumentHistoryGetById(token, documentId);
 
foreach (var historyEntry in documentHistory)
{
   Console.WriteLine("Action Type:{0}, Related Data: {1}, Comment: {2}", historyEntry.ActionType,
                                 historyEntry.RelatedData, historyEntry.Comment);
   if(historyEntry.ActionType=="Document Check In")
   {
	   Console.WriteLine("Previous version {0} found with document id {1}",historyEntry.RelatedVersion,historyEntry.DocumentId);
   }
}
java
String documentId = "<Source document Id retrieved by other method calls>";
SCMDocumentHistory[] documentHistory = springCMService.documentHistoryGetById(token, documentId);
 
for (SCMDocumentHistory historyEntry : documentHistory)
{
 System.out.format("Action Type:%s, Related Data: %s, Comment: %s\n"
 ,historyEntry.getActionType(),historyEntry.getRelatedData(),historyEntry.getComment());
 
 if(historyEntry.getActionType().equals("Document Check In"))
 {
	 System.out.format("Previous version %s found with document id %s\n",
         historyEntry.getRelatedVersion(),historyEntry.getDocumentId());
 }
}