I have used following sub with WPDM -vault search. There are plenty of unnecessary code but maybe you can take something for your needs.
<p></p>
<p><span style="font-family: Consolas;">Public Sub FindButton1_Click()</span></p><p></p><p>Dim Options As PDMWorks.PDMWSearchOptions<br>Dim Criteria As PDMWorks.PDMWSearchCriteria<br>Dim Results As PDMWorks.PDMWSearchResults<br>Dim Result As PDMWorks.PDMWSearchResult</p><p>Dim i, TL As Integer<br>Dim cnt As Integer<br>Dim counter As Integer<br>Dim Search1 As String</p><p>InfoBox1.Clear<br>ProjectBox2.Text = ""<br>ResultBox1.Clear</p><p>counter = 0</p><p>Search1 = TextBox1.Text<br>If Search1 = "" Then GoTo Whoops</p><p>Set Options = Conn.GetSearchOptionsObject</p><p> If Not Options Is Nothing Then</p><p> Options.IgnoreCase = True<br> Options.IgnoreLinks = True<br> Options.IncludeHiddenDocuments = True<br> Options.SearchConfigSpecificProperties = False<br> Options.SearchOnlyChildrenOf = ""<br> Options.SearchCriteria.AddCriteria pdmwOr, pdmwDocumentName, "", pdmwContains, Search1<br> ' Options.SearchCriteria.AddCriteria pdmwAnd, PDMWConfiguration, "", Contains, "default"<br><br> Options.SearchCriteria.SaveToFile "c:\temp\cri_test.sqy"<br> Options.SearchCriteria.LoadFromFile "c:\temp\cri_test.sqy"<br> <br> ' MsgBox "Options set!"<br><br> Set Results = Conn.Search(Options)<br> <br> If Not Results Is Nothing Then<br> cnt = Results.Count<br> counter = cnt<br> ResultLabel.Caption = "Results: " & counter<br> <br> For i = 0 To cnt - 1<br> Set Result = Results(i)<br> ResultBox1.AddItem (Result.Name)<br> ' AddItemToGrid Result<br> Next i<br> End If ' Results<br> <br> End If ' Options</p><p> ' no search awailable, 4 line below<br> If Search1 <> "" Then<br> ' ResultBox1.AddItem (Search1)<br> ' counter = 1<br> End If<br><br> GoTo Whoops</p><p> ' search from document list<br> For TL = 0 To UBound(Var1)<br> If InStr(1, Var1(TL), Search1) > 0 Then<br> ResultBox1.AddItem (Var1(TL))<br> counter = counter + 1<br> End If<br> Next TL</p><p>Whoops:<br>If counter = 0 Then ResultBox1.AddItem ("Nothing found!")</p><p>End Sub</p>
BF
BF2015-03-24
If you know the name of the file, why not just make this simple and use GetSpecificDocument()?
CC
CC2015-03-24
Bill
If I use GetSpecificDocument, what option let me know if the file is in Vault or not - I tried some of it and always got error
Thanks
BF
BF2015-03-24
if it returns Nothing, it did not find the file.
CC
CC2015-03-24
I understand that it returns nothing but I got runtime error
I have used following sub with WPDM -vault search. There are plenty of unnecessary code but maybe you can take something for your needs.
<p><span style="font-family: Consolas;">Public Sub FindButton1_Click()</span></p><p></p><p>Dim Options As PDMWorks.PDMWSearchOptions<br>Dim Criteria As PDMWorks.PDMWSearchCriteria<br>Dim Results As PDMWorks.PDMWSearchResults<br>Dim Result As PDMWorks.PDMWSearchResult</p><p>Dim i, TL As Integer<br>Dim cnt As Integer<br>Dim counter As Integer<br>Dim Search1 As String</p><p>InfoBox1.Clear<br>ProjectBox2.Text = ""<br>ResultBox1.Clear</p><p>counter = 0</p><p>Search1 = TextBox1.Text<br>If Search1 = "" Then GoTo Whoops</p><p>Set Options = Conn.GetSearchOptionsObject</p><p> If Not Options Is Nothing Then</p><p> Options.IgnoreCase = True<br> Options.IgnoreLinks = True<br> Options.IncludeHiddenDocuments = True<br> Options.SearchConfigSpecificProperties = False<br> Options.SearchOnlyChildrenOf = ""<br> Options.SearchCriteria.AddCriteria pdmwOr, pdmwDocumentName, "", pdmwContains, Search1<br> ' Options.SearchCriteria.AddCriteria pdmwAnd, PDMWConfiguration, "", Contains, "default"<br><br> Options.SearchCriteria.SaveToFile "c:\temp\cri_test.sqy"<br> Options.SearchCriteria.LoadFromFile "c:\temp\cri_test.sqy"<br> <br> ' MsgBox "Options set!"<br><br> Set Results = Conn.Search(Options)<br> <br> If Not Results Is Nothing Then<br> cnt = Results.Count<br> counter = cnt<br> ResultLabel.Caption = "Results: " & counter<br> <br> For i = 0 To cnt - 1<br> Set Result = Results(i)<br> ResultBox1.AddItem (Result.Name)<br> ' AddItemToGrid Result<br> Next i<br> End If ' Results<br> <br> End If ' Options</p><p> ' no search awailable, 4 line below<br> If Search1 <> "" Then<br> ' ResultBox1.AddItem (Search1)<br> ' counter = 1<br> End If<br><br> GoTo Whoops</p><p> ' search from document list<br> For TL = 0 To UBound(Var1)<br> If InStr(1, Var1(TL), Search1) > 0 Then<br> ResultBox1.AddItem (Var1(TL))<br> counter = counter + 1<br> End If<br> Next TL</p><p>Whoops:<br>If counter = 0 Then ResultBox1.AddItem ("Nothing found!")</p><p>End Sub</p>If you know the name of the file, why not just make this simple and use GetSpecificDocument()?
Bill
If I use GetSpecificDocument, what option let me know if the file is in Vault or not - I tried some of it and always got error
Thanks
if it returns Nothing, it did not find the file.
I understand that it returns nothing but I got runtime error
Chris