2 Replies Latest reply on Dec 17, 2010 2:48 AM by Geir Danielsen

    How to get the previous 'Approved' revision of a document

    Geir Danielsen



      We have made a simple intranet/internet application to plot documents saved in the EPDM vault.

      Is it possible to get the previous 'Approved' revision of a document via API?



              Dim search As IEdmSearch5 = vault.CreateSearch

              search.AddVariable("DocumentNumber", _DocumentNumber)

              search.FileName = "%." & _extension


              Dim result As IEdmSearchResult5 = search.GetFirstResult

              While Not result Is Nothing

                  If result.StateName = "Approved" Then

                        'do the plot things


                        'return wrong status to user - no plot done

                        msg = result.StateName


                        'But, I want to plot the previous revision of a document

                        'notify on the plotted document that this document is under change

                  end if

        • Re: How to get the previous 'Approved' revision of a document
          Corey Vantilborg



              Do you assign a Vault Revision to each file that enters the 'Approved' state?


              If so the follow code will find all of the version with Revisions assigned(note it is messy and will need some updating for use in your code):


          Private Function findRevs(sPath As String) As Boolean


          On Error Resume Next


          '-path to a local document that can be displayed in the eDrawings control
          '-populates the global collection REVS containing all available vault revisions
          '-assumes drawing and model are at the same REV


          'Enumerate the revisions list
          Dim verEnum As IEdmEnumeratorVersion5
          Set verEnum = vDraw 'vdraw is the active drawing vault document




          Dim pos As IEdmPos5
          Set pos = verEnum.GetFirstRevisionPosition
          Dim rev As IEdmRevision5


          'Enumerate the available revisions and add them to
          While Not pos.IsNull


              Set rev = verEnum.GetNextRevision(pos)
              Debug.Print "Revision position is " & rev.Name
              'Populate the REVS collection
              revs.Add CStr(UCase(Trim(rev.Name)))




          Debug.Print "Number of available revisions: " & revs.Count


          If Err.Number <> 0 Then findRevs = False Else findRevs = True


          End Function


            Then you can use IEdm5::GetFileCopy to specify the revision you want.


          Corey V