Vault Search with criteria error

Vault Search with criteria error

Anonymous
Not applicable
721 Views
3 Replies
Message 1 of 4

Vault Search with criteria error

Anonymous
Not applicable

Hello!

I Have a problem with vb.net and Vault.

 

I would find  file with criteria (one file with code)

Of this file extract the Boom.

Search drawing contents in the file of the Boom

Open this drawing.

 

This my code for search:

 

    Public Function getFileIteration(nameOfFile As String, connection As VDF.Vault.Currency.Connections.Connection) As VDF.Vault.Currency.Entities.FileIteration
        Dim SrcCond As New SrchCond
        With SrcCond
            .PropDefId = 8
            .SrchOper = 1
            .SrchTxt = nameOfFile
            .PropTyp = PropertySearchType.SingleProperty
        End With
        ' search for files     
        Dim Bookmark As String = String.Empty
        Dim Status As SrchStatus = Nothing
        Dim FileList As New List(Of Autodesk.Connectivity.WebServices.File) '()

        While (Status Is Nothing OrElse FileList.Count < Status.TotalHits)
            Dim files As Autodesk.Connectivity.WebServices.File() = connection.WebServiceManager.DocumentService.FindFilesBySearchConditions(New SrchCond() {SrcCond}, Nothing, Nothing, True, True, Bookmark, Status)
            If (files IsNot Nothing) Then
                FileList.AddRange(files)
            End If
        End While
        Dim oFileIteration As VDF.Vault.Currency.Entities.FileIteration = Nothing
        For i As Integer = 0 To FileList.Count - 1
            If FileList(i).Name = nameOfFile Then
                oFileIteration = New VDF.Vault.Currency.Entities.FileIteration(connection, FileList(i))
            End If
        Next
        ListBox1.Items.Add(oFileIteration)
        Return oFileIteration
    End Function

I have this error:

Error:

  Autodesk.Connectivity.WebServices.VaultServiceErrorException: '4602'

 

if i load the entire list of vaults file everything works

Please help!!

0 Likes
722 Views
3 Replies
Replies (3)
Message 2 of 4

psaarloos
Collaborator
Collaborator

Hi,

 

I think you are missing a property (SrchRule) in the search condition. Change it into:

 

With SrcCond
            .PropDefId = 8
            .SrchOper = 1
            .SrchTxt = nameOfFile
            .PropTyp = PropertySearchType.SingleProperty
            .SrchRule = SearchRuleType.Must
End With

Hope it helps!

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 3 of 4

Anonymous
Not applicable

Doesn't work

Same error.Smiley Sad

 

Autodesk.Connectivity.WebServices.VaultServiceErrorException: '4602'

0 Likes
Message 4 of 4

Anonymous
Not applicable

Solved with this solution!!!!

 

    Dim conditions As ACW.SrchCond()
        ReDim conditions(0)
        Dim Defs As ACW.PropDef() = connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE")
        Dim Prop As ACW.PropDef = Nothing
        For Each def As ACW.PropDef In Defs
            If def.DispName = "File Name" Then
                Prop = def
            End If
        Next def        Dim searchCondition As ACW.SrchCond = New ACW.SrchCond()
        searchCondition.PropDefId = Prop.Id
        searchCondition.PropTyp = ACW.PropertySearchType.SingleProperty
        searchCondition.SrchOper = 1
        searchCondition.SrchTxt = nameOfFile
        conditions(0) = searchCondition
0 Likes