Click or drag to resize

GetRevs procedure

This example retrieves all revisions of the document with a given ID and displays it revision number and path.

Visual Basic 6
Sub GetRevs(DR As AMDocumentRepository, strFileID As String)
  'Build list in mcolExportRevs of Revisions to export
  Dim iamVer As IAMVersionable4
  Dim Revs As IAMTableView
  Dim Rev As IAMDocument7
  Debug.Print "strFileId is " & strFileID
  'Test for what type of rev to export
  Select Case gRevType
    Case rtEverything
      'Walk through all revisions
      Set iamVer = DR.GetFSObject(strFileID)
      Set Revs = iamVer.Versions
      For Each Rev In Revs
        Set iamVer = Rev
        Debug.Print("Version is " & iamVer.VersionNr)
        Debug.Print "Full Path is "; Rev.Repository.path(True) & Rev.path
      Next
      Stop
  End Select
End Sub
Visual Basic .NET
'Walk through all revisions 
Sub GetRevs(ByVal dr As BCRepository, ByVal strFileID As String) 
  Using d As BCDocument = dr.GetFSObject(strFileID) 
    Using Revs As BCReadOnlyCollection(Of BCDocument) = d.Versionable.Versions
          'Although we do not recommend enumerating collections with an indexer,
          'the API does not yet provide a method to instantiate a live object
          'that represents a revision of a document by its ID. In order to display
          'the properties in this example, it violates that guideline.
      For i As Integer = 0 To Revs.Count - 1 
        Using Rev As BCDocument = Revs.Item(i) 
          Debug.Print("Version is " & Rev.Versionable.VersionNr) 
          Debug.Print("Full path is " & dr.Path(True) & Rev.Path()) 
        End Using 
      Next 
    End Using 
  End Using 
End Sub
See Also