5 Replies Latest reply on Mar 24, 2015 12:22 PM by Chris Champions

    Check if file is in the Vault

    Chris Champions

      Is there API call to check if the file is in the Vault or not?

      Thank you

        • Re: Check if file is in the Vault
          Tapani Sjoman

          I have used following sub with WPDM -vault search. There are plenty of unnecessary code but maybe you can take something for your needs.

           

           

          Public Sub FindButton1_Click()
          
          Dim Options     As PDMWorks.PDMWSearchOptions
          Dim Criteria    As PDMWorks.PDMWSearchCriteria
          Dim Results     As PDMWorks.PDMWSearchResults
          Dim Result      As PDMWorks.PDMWSearchResult
          Dim i, TL   As Integer
          Dim cnt     As Integer
          Dim counter As Integer
          Dim Search1 As String
          InfoBox1.Clear
          ProjectBox2.Text = ""
          ResultBox1.Clear
          counter = 0
          Search1 = TextBox1.Text
          If Search1 = "" Then GoTo Whoops
          Set Options = Conn.GetSearchOptionsObject
           If Not Options Is Nothing Then
              Options.IgnoreCase = True
              Options.IgnoreLinks = True
              Options.IncludeHiddenDocuments = True
              Options.SearchConfigSpecificProperties = False
              Options.SearchOnlyChildrenOf = ""
              Options.SearchCriteria.AddCriteria pdmwOr, pdmwDocumentName, "", pdmwContains, Search1
           '   Options.SearchCriteria.AddCriteria pdmwAnd, PDMWConfiguration, "", Contains, "default"
           
              Options.SearchCriteria.SaveToFile "c:\temp\cri_test.sqy"
              Options.SearchCriteria.LoadFromFile "c:\temp\cri_test.sqy"
              
           '   MsgBox "Options set!"
           
              Set Results = Conn.Search(Options)
              
              If Not Results Is Nothing Then
                cnt = Results.Count
                counter = cnt
                ResultLabel.Caption = "Results: " & counter
                
                For i = 0 To cnt - 1
                   Set Result = Results(i)
                   ResultBox1.AddItem (Result.Name)
                  ' AddItemToGrid Result
                Next i
              End If  ' Results
              
           End If  ' Options
              ' no search awailable, 4 line below
              If Search1 <> "" Then
              ' ResultBox1.AddItem (Search1)
              ' counter = 1
              End If
           
              GoTo Whoops
              ' search from document list
              For TL = 0 To UBound(Var1)
                  If InStr(1, Var1(TL), Search1) > 0 Then
                      ResultBox1.AddItem (Var1(TL))
                      counter = counter + 1
                  End If
              Next TL
          Whoops:
          If counter = 0 Then ResultBox1.AddItem ("Nothing found!")
          End Sub
          
          • Re: Check if file is in the Vault
            Bill Florac

            If you know the name of the file, why not just make this simple and use GetSpecificDocument()?